1 # DO NOT EDIT - This file is being maintained by Chef
4 # Basic server configuration
5 ServerName <%= node.name %>
6 ServerAlias tile.openstreetmap.org
7 ServerAlias render.openstreetmap.org
8 ServerAdmin webmaster@openstreetmap.org
15 SSLCertificateFile /etc/ssl/certs/<%= node[:fqdn] %>.pem
16 SSLCertificateKeyFile /etc/ssl/private/<%= node[:fqdn] %>.key
18 # Configure location of static files and CGI scripts
19 DocumentRoot /srv/tile.openstreetmap.org/html
20 ScriptAlias /cgi-bin/ /srv/tile.openstreetmap.org/cgi-bin/
22 # Get the real remote IP for requests via a trusted proxy
23 RemoteIPHeader Fastly-Client-IP
24 <% @fastly.sort.each do |address| -%>
25 RemoteIPTrustedProxy <%= address %>
29 LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_with_remoteip
30 CustomLog /var/log/apache2/access.log combined_with_remoteip
31 ErrorLog /var/log/apache2/error.log
34 # Always set Access-Control-Allow-Origin so that simple CORS requests
35 # will always work and can be cached
36 Header set Access-Control-Allow-Origin "*"
38 # Add diagnostics header to identify render server
39 Header set X-TileRender "<%= node.name %>"
41 # Tell clients to use stale tiles if necessary
42 Header append Cache-Control "stale-while-revalidate=604800, stale-if-error=604800" "expr=%{CONTENT_TYPE} == 'image/png'"
44 # Remove Proxy request header to mitigate https://httpoxy.org/
45 RequestHeader unset Proxy early
47 # Enable the rewrite engine
51 RewriteMap ipmap txt:/srv/tile.openstreetmap.org/conf/ip.map
52 RewriteCond ${ipmap:%{REMOTE_ADDR}} ^.+$
53 RewriteRule ^.*$ /${ipmap:%{REMOTE_ADDR}} [PT]
55 # Rewrite tile requests to the default style
56 RewriteRule ^/(\d+)/(\d+)/(\d+)\.png$ /default/$1/$2/$3.png [PT,T=image/png,L]
57 RewriteRule ^/(\d+)/(\d+)/(\d+)\.png/status/?$ /default/$1/$2/$3.png/status [PT,T=text/plain,L]
58 RewriteRule ^/(\d+)/(\d+)/(\d+)\.png/dirty/?$ /default/$1/$2/$3.png/dirty [PT,T=text/plain,L]
60 # Historical Files redirect
61 RedirectPermanent /processed_p.tar.bz2 https://planet.openstreetmap.org/historical-shapefiles/
62 RedirectPermanent /shoreline_300.tar.bz2 https://planet.openstreetmap.org/historical-shapefiles/
63 RedirectPermanent /world_boundaries-spherical.tgz https://planet.openstreetmap.org/historical-shapefiles/
65 # Redirect ACME certificate challenges
66 RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
68 # Internal endpoint for blocked users
70 Header always set Cache-Control private
76 # Basic server configuration
77 ServerName <%= node.name %>
78 ServerAlias tile.openstreetmap.org
79 ServerAlias render.openstreetmap.org
80 ServerAdmin webmaster@openstreetmap.org
83 LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_with_remoteip
84 CustomLog /var/log/apache2/access.log combined_with_remoteip
85 ErrorLog /var/log/apache2/error.log
88 # Always set Access-Control-Allow-Origin so that simple CORS requests
89 # will always work and can be cached
90 Header set Access-Control-Allow-Origin "*"
92 # Add diagnostics header to identify render server
93 Header set X-TileRender "<%= node.name %>"
95 # Remove Proxy request header to mitigate https://httpoxy.org/
96 RequestHeader unset Proxy early
98 # Enable the rewrite engine
101 # Redirect ACME certificate challenges
102 RewriteRule ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 [R=permanent,L]
105 RewriteCond %{REQUEST_URI} !^/server-status$
106 RewriteCond %{REQUEST_URI} !^/mod_tile$
107 RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=permanent,L]
110 <Directory /srv/tile.openstreetmap.org/html>
116 <Directory /srv/tile.openstreetmap.org/cgi-bin>