diff --git a/images/web/Dockerfile b/images/web/Dockerfile index 7d64bd91..a4839d50 100644 --- a/images/web/Dockerfile +++ b/images/web/Dockerfile @@ -106,7 +106,6 @@ RUN chown -R www-data: $workdir # Add settings ADD config/settings.yml $workdir/config/ -# ADD config/lighttpd.conf /etc/lighttpd/lighttpd.conf COPY start.sh $workdir/ diff --git a/images/web/config/lighttpd.conf b/images/web/config/lighttpd.conf deleted file mode 100644 index af423f47..00000000 --- a/images/web/config/lighttpd.conf +++ /dev/null @@ -1,95 +0,0 @@ -# default document-root -server.document-root = "/openstreetmap/cgimap/" - -# TCP port -server.port = 81 - -server.reject-expect-100-with-417 = "disable" - -# selecting modules -server.modules = ( "mod_access", "mod_rewrite", "mod_fastcgi", "mod_proxy", "mod_alias", "mod_setenv") - -# accesslog.filename = "/dev/stdout" -# server.errorlog = "/dev/stderr" -server.errorlog = "/var/log/lighttpd/error.log" - -# handling unknown routes -server.error-handler-404 = "/dispatch.map" - -mimetype.assign = ( - ".html" => "text/html", - ".txt" => "text/plain", - ".jpg" => "image/jpeg", - ".png" => "image/png" -) - -# Handle CORS Preflight Requests -$HTTP["request-method"] == "OPTIONS" { - setenv.add-response-header = ( - "Access-Control-Allow-Origin" => "*", - "Access-Control-Allow-Methods" => "GET, POST, PUT, DELETE, OPTIONS", - "Access-Control-Allow-Headers" => "origin, x-requested-with, content-type", - "Access-Control-Allow-Credentials" => "true", - "Access-Control-Max-Age" => "86400" - ) - # url.access-allow = ("/") # Allow all URLs for OPTIONS requests - url.access-allow = ("/dispatch.map") - -} - -$HTTP["url"] =~ "^/api/0\.6/map" { - setenv.add-response-header = ( - "Access-Control-Allow-Origin" => "*", - "Access-Control-Allow-Methods" => "GET, POST, PUT, DELETE, OPTIONS", - "Access-Control-Allow-Headers" => "origin, x-requested-with, content-type", - "Access-Control-Allow-Credentials" => "true", - "Access-Control-Max-Age" => "86400" - ) - # url.access-allow = ("/") # Allow all URLs for OPTIONS requests - url.access-allow = ("/dispatch.map") - -} - -debug.log-request-handling = "enable" - -$HTTP["request-method"] == "GET" { - url.rewrite-once = ( - "^/api/0\.6/map(\.(json|xml))?(\?(.*))?$" => "/dispatch.map", - "^/api/0\.6/(node|way|relation)/[[:digit:]]+(\.(json|xml))?$" => "/dispatch.map", - "^/api/0\.6/(node|way|relation)/[[:digit:]]+/history.*$" => "/dispatch.map", - "^/api/0\.6/(node|way|relation)/[[:digit:]]+/[[:digit:]]+.*$" => "/dispatch.map", - "^/api/0\.6/(node|way|relation)/[[:digit:]]+/relations$" => "/dispatch.map", - "^/api/0\.6/node/[[:digit:]]+/ways$" => "/dispatch.map", - "^/api/0\.6/(way|relation)/[[:digit:]]+/full$" => "/dispatch.map", - "^/api/0\.6/changeset/[[:digit:]]+.*$" => "/dispatch.map", - "^/api/0\.6/(nodes|ways|relations)(\?(.*))?$" => "/dispatch.map", - "^/api/0\.6/changeset/[[:digit:]]+/download$" => "/dispatch.map", - ) -} - -$HTTP["request-method"] == "POST" { - url.rewrite-once = ( - "^/api/0\.6/changeset/[[:digit:]]+/upload.*$" => "/dispatch.map", - ) -} - -$HTTP["request-method"] == "PUT" { - url.rewrite-once = ( - "^/api/0\.6/changeset/[[:digit:]]+/close.*$" => "/dispatch.map", - "^/api/0\.6/changeset/[[:digit:]]+$" => "/dispatch.map", - "^/api/0\.6/changeset/create.*$" => "/dispatch.map", - ) -} - -$HTTP["url"] =~ "^/(?!(dispatch\.map))" { - proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => "80" ) ) ) -} - -fastcgi.debug = 1 - -fastcgi.server = ( ".map" => - (( "host" => "127.0.0.1", - "port" => 8000, - "check-local" => "disable", - )) -) diff --git a/images/web/config/production.conf b/images/web/config/production.conf index 4797d990..5b41eb1c 100644 --- a/images/web/config/production.conf +++ b/images/web/config/production.conf @@ -18,6 +18,10 @@ RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + + CGIPassAuth On + + # ======Proxying traffic to CGImap==== RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$