-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update apache rules for CORS Set CORS headers Set CORS option for cgimap Set CORS headers
- Loading branch information
Rub21
committed
Sep 11, 2023
1 parent
a8ce7f6
commit 70ef187
Showing
4 changed files
with
28 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,50 @@ | ||
<VirtualHost *:80> | ||
# ServerName localhost | ||
|
||
# Tell Apache and Passenger where your app's 'public' directory is | ||
DocumentRoot /var/www/public | ||
PassengerRuby /usr/bin/ruby | ||
|
||
RewriteEngine On | ||
RewriteCond %{HTTP:X-Forwarded-Proto} =http | ||
# Development mode in case domain is localhost | ||
|
||
# Development mode in case domain is localhost | ||
# Rewrite to HTTPS | ||
RewriteCond %{HTTP:X-Forwarded-Proto} =http | ||
RewriteCond %{HTTP_HOST} !=localhost | ||
RewriteCond %{HTTPS} off | ||
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | ||
|
||
# Rewrite to www. [NC] is a case-insensitive match | ||
RewriteCond %{HTTP_HOST} !=localhost | ||
# Avoid redirect staging sites | ||
RewriteCond %{HTTP_HOST} !=staging.openhistoricalmap.org | ||
RewriteCond %{HTTP_HOST} !^www\. [NC] | ||
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | ||
|
||
# ======Redirect trafict to CGIMAP==== | ||
# ======Redirect traffic to CGIMAP==== | ||
# Rules to redirect to port 81 | ||
RewriteCond %{REQUEST_URI} ^/api/0\.6/map | ||
RewriteRule ^.*$ http://127.0.0.1:81%{REQUEST_URI} [P,L] | ||
|
||
# Existing rewrites | ||
RewriteRule ^0\.6/map$ - [L,H=fcgi:127.0.0.1:81] | ||
RewriteRule ^0\.6/(nodes|ways|relations)$ - [L,H=fcgi:127.0.0.1:81] | ||
RewriteRule ^0\.6/(way|relation)/([^/]+)/full$ - [L,H=fcgi:127.0.0.1:81] | ||
|
||
# If no match found, fall through to port 80 | ||
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$ | ||
RewriteRule ^0\.6/(node|way|relation)/([^/]+)$ - [L,H=fcgi:127.0.0.1:80] | ||
|
||
# Set CORS headers for any request within openhistoricalmap.org | ||
Header set Access-Control-Allow-Origin "*" | ||
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS" | ||
Header set Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range" | ||
Header set Access-Control-Expose-Headers "Content-Length,Content-Range" | ||
|
||
# Relax Apache security settings | ||
<Directory /var/www/public> | ||
AllowOverride None | ||
Allow from all | ||
Options -MultiViews | ||
AllowOverride None | ||
Require all granted | ||
# Allow from all | ||
Options -MultiViews | ||
</Directory> | ||
</VirtualHost> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters