From 3415dc30f7faf0000e2e982788cef43f280735ac Mon Sep 17 00:00:00 2001 From: Rub21 Date: Thu, 14 Sep 2023 17:48:00 -0500 Subject: [PATCH] Update config --- images/web/config/production.conf | 32 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/images/web/config/production.conf b/images/web/config/production.conf index e7cfa04a..95a86880 100644 --- a/images/web/config/production.conf +++ b/images/web/config/production.conf @@ -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