@%@UCRWARNING=# @%@

ProxyPreserveHost on

@!@
port = int( configRegistry.get('umc/http/port', 8090) )
interface = configRegistry.get('umc/http/interface', '127.0.0.1')

print 'ProxyPass /umcp/ http://%s:%s/ retry=0' % (interface, port)
print 'ProxyPassReverse /umcp/ http://%s:%s/' % (interface, port)
print 'ProxyTimeout %s' % int(configRegistry.get('umc/http/session/timeout', '300'))
@!@
RequestHeader set X-Forwarded-Proto %{HTTPS}s

RedirectMatch ^/umc(/$|$) /univention-management-console/
RedirectMatch ^/univention-management-console$ /univention-management-console/
RewriteEngine On
RewriteRule ^/univention-management-console/style/(.*) /style/$1 [L]

# rewrite non existing files in js/dijit/themes/umc to old /images path if they exists there; see Bug #29861
RewriteCond %{REQUEST_URI} ^/univention-management-console/js[^/]*/dijit/themes/umc/(.*)
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %1 !(?:^|/)[.][.]/
RewriteCond %{DOCUMENT_ROOT}univention-management-console/images/%1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}univention-management-console/images/%1 -d
RewriteRule ^/univention-management-console/js[^/]*/dijit/themes/umc/(.*) /univention-management-console/images/$1 [R=301]

# make sure that requests for files in an old hashed javascript directory
# are redirected; this applies only to GET requests as a HEAD request
# should still fail to allow the detection of changes by JavaScript;
# see Bug #29588
RewriteCond %{REQUEST_URI} ^/(univention-management-console/js_[^/]*)/.*
RewriteCond %{DOCUMENT_ROOT}/%1 !-f
RewriteCond %{DOCUMENT_ROOT}/%1 !-d
RewriteCond %{REQUEST_METHOD} ^GET
RewriteRule ^(/univention-management-console/js)_[^/]*/(.*) $1/$2 [R=301]

# fix for bug in cherrypy returnin 408/409 errors out of the blue:
#   http://cherrypy.org/ticket/853
SetEnv proxy-nokeepalive 1

<Directory /var/www/univention-management-console>
</Directory>

