diff --git a/terraform/applications/nginx-waf/nginx/conf.d/default.conf b/terraform/applications/nginx-waf/nginx/conf.d/default.conf index 55023965..13b73f10 100644 --- a/terraform/applications/nginx-waf/nginx/conf.d/default.conf +++ b/terraform/applications/nginx-waf/nginx/conf.d/default.conf @@ -1,7 +1,11 @@ -# map $http_upgrade $connection_upgrade { -# default upgrade; -# '' close; -# } +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +map $request_uri $error_page { + default /404/index.html; +} server { server_name _; @@ -17,16 +21,6 @@ server { set $port 8882; } - location @fourohfour { - allow all; - access_log off; - internal; - - default_type text/html; - rewrite ^ /404/index.html break; - include nginx/snippets/proxy-to-static.conf; - } - location ^~ /s3/files { set $port 8883; proxy_redirect off; @@ -58,18 +52,30 @@ server { listen 8881; location @fourohfour { - return 404; + allow all; + access_log off; + + rewrite ^ $error_page; + + proxy_hide_header Content-Type; + add_header Content-Type 'text/html'; + + include nginx/snippets/proxy-to-static.conf; } + location = /favicon.ico { + log_not_found off; + access_log off; + } + location / { - #rewrite ^/static/(.*) /$1; rewrite ^([^.]*[^/])$ $1/; rewrite (.*)/$ $1/index.html last; #include nginx/dynamic/deny-by-domain.conf; # include nginx/snippets/ip-restrict-static.conf; include nginx/snippets/proxy-to-static.conf; - error_page 403 = @fourohfour; + error_page 403 404 =404 @fourohfour; } }