Skip to content

Commit

Permalink
Update config
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Sep 14, 2023
1 parent 559c37a commit 3415dc3
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions images/web/config/production.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,26 @@
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ======Redirect trafict to CGIMAP====
# Rules to redirect to port 81
RewriteCond %{REQUEST_URI} ^/api/0\.6/map
RewriteRule ^.*$ https://cgimap-staging.openhistoricalmap.org%{REQUEST_URI} [P,L]
# Existing rewrites
RewriteRule ^0\.6/map$ - [L,H=fcgi:cgimap-staging.openhistoricalmap.org]
RewriteRule ^0\.6/(nodes|ways|relations)$ - [L,H=fcgi:cgimap-staging.openhistoricalmap.org]
RewriteRule ^0\.6/(way|relation)/([^/]+)/full$ - [L,H=fcgi:cgimap-staging.openhistoricalmap.org]

# 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]
# Pass supported calls to cgimap
RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:81$0 [P]
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://127.0.0.1:81$0 [P]
RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://127.0.0.1:81$0 [P]
RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://127.0.0.1:81$0 [P]
RewriteRule ^/api/0\.6/node/[0-9]+/ways(\.json|\.xml)?$ fcgi://127.0.0.1:81$0 [P]
RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full(\.json|\.xml)?$ fcgi://127.0.0.1:81$0 [P]
RewriteRule ^/api/0\.6/(nodes|ways|relations)(\.json|\.xml)?$ fcgi://127.0.0.1:81$0 [P]
RewriteRule ^/api/0\.6/changeset/[0-9]+/(upload|download)(\.json|\.xml)?$ fcgi://127.0.0.1:81$0 [P]

# Redirect non-api requests made to api.openhistoricalmap.org to www.openhistoricalmap.org
# Staging
RewriteCond %{HTTP_HOST} =api.staging.openhistoricalmap.org
RewriteCond %{REQUEST_URI} !^/api/
RewriteRule ^(.*)$ https://staging.openhistoricalmap.org$1 [L,NE,R=permanent]
# Production
RewriteCond %{HTTP_HOST} =api.openhistoricalmap.org
RewriteCond %{REQUEST_URI} !^/api/
RewriteRule ^(.*)$ https://www.openhistoricalmap.org$1 [L,NE,R=permanent]

# Relax Apache security settings
<Directory /var/www/public>
Expand Down

0 comments on commit 3415dc3

Please sign in to comment.