~simpoir/landscape-charm/charm_push_target

« back to all changes in this revision

Viewing changes to config/vhost.tmpl

  • Committer: 🤖 Landscape Builder
  • Author(s): Alberto Donato
  • Date: 2017-03-20 13:31:47 UTC
  • mfrom: (383.1.3 block-metrics-through-haproxy)
  • Revision ID: _landscape_builder-20170320133147-muuowqgkpkuzxu13
Merge block-metrics-through-haproxy [f=1674291] [r=fginther,adam-collard,landscape-builder] [a=Alberto Donato]
Change the haproxy configuration to prevent access to the /metrics endpoint on the landscape unit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<VirtualHost *:80>
2
 
    ServerName {{ servername }}
3
 
    ServerAdmin webmaster@%{SERVER_NAME}
4
 
    DocumentRoot /var/www
5
 
 
6
 
    ErrorLog /var/log/apache2/vhost_http_error.log
7
 
    CustomLog /var/log/apache2/vhost_http_access.log combined
8
 
 
9
 
    # Set a Via header in outbound requests to the proxy, so proxied apps can
10
 
    # know who the actual client is
11
 
    ProxyVia on
12
 
    ProxyTimeout 10
13
 
 
14
 
    <Location "/">
15
 
        Options -Indexes
16
 
        Order allow,deny
17
 
        Allow from all
18
 
    </Location>
19
 
    <Location "/r">
20
 
        FileETag none
21
 
        ExpiresActive on
22
 
        ExpiresDefault "access plus 10 years"
23
 
        Header append Cache-Control "public"
24
 
    </Location>
25
 
    <Location "/repository">
26
 
        Options +Indexes
27
 
    </Location>
28
 
 
29
 
    <Files "*.woff">
30
 
        FileETag None
31
 
        Header append Cache-Control "max-age=2592000,public"
32
 
        Header unset Last-Modified
33
 
    </Files>
34
 
 
35
 
    RewriteEngine On
36
 
 
37
 
    # Pings can always go unencrypted
38
 
    RewriteRule ^/ping$ http://{{ haproxy_pingserver }}/ping [P,L]
39
 
 
40
 
    RewriteRule ^/r/([^/]+)/(.*) /$2
41
 
 
42
 
    # bug #685958
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
55
 
 
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]
59
 
 
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]
66
 
</VirtualHost>