Skip to content

Commit

Permalink
DIGITAL-90: Configure 404 page.
Browse files Browse the repository at this point in the history
  • Loading branch information
casey-rapnicki-bixal committed Jan 9, 2025
1 parent 9ed40eb commit cb471f9
Showing 1 changed file with 5 additions and 51 deletions.
56 changes: 5 additions & 51 deletions terraform/applications/nginx-waf/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
# '' close;
# }

# map $request_uri $error_page {
# default /404/index.html;
# ~/(?<lang>[a-z][a-z]?[a-z]|zh-hans)/(.*) /$lang/404/index.html;
# }

server {
server_name _;
listen $VCAP_APP_PORT;
Expand All @@ -16,9 +11,6 @@ server {
modsecurity_rules_file /home/vcap/app/nginx/snippets/owasp-modsecurity-main.conf;

set $cf_forwarded_host "$host";
#if ($http_x_cf_forwarded_url ~* ^(https?\:\/\/)(.*?)(\/(.*))?$) {
# set $cf_forwarded_host "$2";
#}

set $port 8881;
if ($cf_forwarded_host ~* \-drupal\-) {
Expand All @@ -28,7 +20,7 @@ server {
location @fourohfour {
allow all;
access_log off;

default_type text/html;
rewrite ^ /404/index.html;
include nginx/snippets/proxy-to-static.conf;
Expand Down Expand Up @@ -66,13 +58,7 @@ server {
listen 8881;

location @fourohfour {
allow all;
access_log off;

default_type text/html;
rewrite ^ /404/index.html;
include nginx/snippets/proxy-to-static.conf;
break;
return 404;
}

location / {
Expand All @@ -83,7 +69,7 @@ server {
#include nginx/dynamic/deny-by-domain.conf;
# include nginx/snippets/ip-restrict-static.conf;
include nginx/snippets/proxy-to-static.conf;
error_page 403 404 =404 @fourohfour;
error_page 403 = @fourohfour;
}
}

Expand All @@ -94,7 +80,6 @@ server {
error_page 403 = @forbidden;

location @forbidden {

allow all;
access_log off;

Expand Down Expand Up @@ -220,13 +205,7 @@ server {
rewrite ^/s3/files/(.*)$ /cms/public/$1 break;

location @fourohfour {
allow all;
access_log off;

default_type text/html;
rewrite ^ /404/index.html;
include nginx/snippets/proxy-to-static.conf;
break;
return 404;
}

location / {
Expand All @@ -237,31 +216,6 @@ server {
#include nginx/dynamic/deny-by-domain.conf;
# include nginx/snippets/ip-restrict-static.conf;
include nginx/snippets/proxy-to-storage.conf;
error_page 403 404 =404 @fourohfour;
}
}

server {
server_name 127.0.0.1;
listen 8884;


location @fourohfour {
allow all;
access_log off;

default_type text/html;
rewrite ^ /404/index.html;
include nginx/snippets/proxy-to-static.conf;
break;
}

location / {
rewrite ^/static/(.*) /$1;
rewrite ^([^.]*[^/])$ $1/;
rewrite (.*)/$ $1/index.html last;

include nginx/snippets/proxy-to-static.conf;
error_page 403 404 =404 @fourohfour;
error_page 403 = @fourohfour;
}
}

0 comments on commit cb471f9

Please sign in to comment.