2
ServerName {{ servername }}
3
ServerAdmin webmaster@%{SERVER_NAME}
6
ErrorLog /var/log/apache2/vhost_http_error.log
7
CustomLog /var/log/apache2/vhost_http_access.log combined
9
# Set a Via header in outbound requests to the proxy, so proxied apps can
10
# know who the actual client is
22
ExpiresDefault "access plus 10 years"
23
Header append Cache-Control "public"
25
<Location "/repository">
31
Header append Cache-Control "max-age=2592000,public"
32
Header unset Last-Modified
37
# Pings can always go unencrypted
38
RewriteRule ^/ping$ http://{{ haproxy_pingserver }}/ping [P,L]
40
RewriteRule ^/r/([^/]+)/(.*) /$2
43
# Map the internal lowercase function so we can use it below.
44
RewriteMap lowercase int:tolower
45
# Only lookup skin name in cookie value for the favicon.
46
RewriteCond %{REQUEST_URI} ^/favicon.ico$
47
# If there's a 'skin' selected in the cookie...
48
RewriteCond %{HTTP_COOKIE} skin=([^;\ ]+) [OR]
49
# Else, use the default skin.
50
RewriteCond manx ^(.+)$
51
# If the skin name is a valid one...
52
RewriteCond ${lowercase:%1} ^(manx|hokan)$
53
# Then rewrite the url to be relative to the specified skin.
54
RewriteRule ^/(.*) /static/skin/%1/$1
56
# The following resources are remote and fine to go over http
57
RewriteRule ^/(static.*) http://{{ haproxy_static }}/$1 [P,L]
58
RewriteRule ^/(repository.*) http://{{ haproxy_static }}/$1 [P,L]
60
# local resources, don't redirect anywhere not even to switch to https
61
RewriteCond %{REQUEST_URI} !/server-status
62
RewriteCond %{REQUEST_URI} !/icons
63
RewriteCond %{REQUEST_URI} !/robots.txt
64
# Everything else needs to go over https
65
RewriteRule ^/(.*) https://{{ servername }}/$1 [R=permanent]