|
2 | 2 | # ServerName localhost |
3 | 3 | # Tell Apache and Passenger where your app's 'public' directory is |
4 | 4 | DocumentRoot /var/www/public |
| 5 | + PassengerAppEnv production |
5 | 6 | PassengerRuby /usr/local/bin/ruby |
6 | 7 | RewriteEngine On |
7 | 8 |
|
8 | | - # Redirect HTTP to HTTPS for current domain (except localhost) |
| 9 | + # Redirect to HTTPS |
| 10 | + RewriteCond %{HTTP:X-Forwarded-Proto} =http |
9 | 11 | RewriteCond %{HTTP_HOST} !=localhost |
10 | 12 | RewriteCond %{HTTP_HOST} !=127.0.0.1 |
11 | 13 | RewriteCond %{HTTPS} off |
12 | | - RewriteCond %{HTTP:X-Forwarded-Proto} !https |
13 | 14 | RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
14 | 15 |
|
| 16 | + # Redirect to www |
| 17 | + RewriteCond %{HTTP_HOST} =SERVER_DOMAIN_PLACEHOLDER |
| 18 | + RewriteCond %{HTTP_HOST} !^www\. [NC] |
| 19 | + RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
| 20 | + |
15 | 21 | <Location /> |
16 | 22 | CGIPassAuth On |
17 | 23 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 |
18 | 24 | </Location> |
19 | 25 |
|
20 | | - # Proxying traffic to CGImap |
| 26 | + #Proxying traffic to CGImap |
21 | 27 | ProxyTimeout 1200 |
22 | 28 | RewriteCond %{REQUEST_URI} ^/api/0\.6/map |
23 | 29 | RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://${CGIMAP_URL}:${CGIMAP_PORT}$0 [P] |
24 | | - |
25 | | - RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ |
26 | 30 | RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://${CGIMAP_URL}:${CGIMAP_PORT}$0 [P] |
27 | 31 | RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://${CGIMAP_URL}:${CGIMAP_PORT}$0 [P] |
28 | 32 | RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://${CGIMAP_URL}:${CGIMAP_PORT}$0 [P] |
|
48 | 52 | FcgidIOTimeout 1200 |
49 | 53 | FcgidConnectTimeout 1200 |
50 | 54 | </IfModule> |
| 55 | + |
| 56 | + # Allow CORS for JSON, PBF, and PNG files for map-style |
| 57 | + <FilesMatch "\.(json|pbf|png)$"> |
| 58 | + Header set Access-Control-Allow-Origin "*" |
| 59 | + Header set Access-Control-Allow-Methods "GET, OPTIONS" |
| 60 | + Header set Access-Control-Allow-Headers "Content-Type" |
| 61 | + </FilesMatch> |
| 62 | + |
51 | 63 | </VirtualHost> |
0 commit comments