From 06633fe2842f0ca145ce472e4cc229b4bad5d1a3 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Mon, 11 Sep 2023 16:02:04 -0500 Subject: [PATCH] Set CORS option for cgimap --- images/web/config/lighttpd.conf | 7 ++++++- images/web/config/production.conf | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/images/web/config/lighttpd.conf b/images/web/config/lighttpd.conf index 85520b80..3e11ed9a 100644 --- a/images/web/config/lighttpd.conf +++ b/images/web/config/lighttpd.conf @@ -7,7 +7,12 @@ server.port = 81 server.reject-expect-100-with-417 = "disable" # selecting modules -server.modules = ( "mod_access", "mod_rewrite", "mod_fastcgi", "mod_proxy", "mod_alias" ) +server.modules = ( "mod_access", "mod_rewrite", "mod_fastcgi", "mod_proxy", "mod_alias", "mod_setenv" ) # Added mod_setenv + +# Add CORS headers to all responses +setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*", + "Access-Control-Allow-Methods" => "GET, POST, PUT, OPTIONS", + "Access-Control-Allow-Headers" => "origin, x-requested-with, content-type" ) # handling unknown routes server.error-handler-404 = "/dispatch.map" diff --git a/images/web/config/production.conf b/images/web/config/production.conf index 113a3693..5ef5619b 100644 --- a/images/web/config/production.conf +++ b/images/web/config/production.conf @@ -30,12 +30,6 @@ RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$ RewriteRule ^0\.6/(node|way|relation)/([^/]+)$ - [L,H=fcgi:127.0.0.1:80] - # Set CORS headers - 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 AllowOverride None @@ -43,4 +37,3 @@ Options -MultiViews -