diff --git a/reverse-proxy/conf.d.dev/default.conf b/reverse-proxy/conf.d.dev/default.conf index 89bb7fbf2..6c82ed79b 100644 --- a/reverse-proxy/conf.d.dev/default.conf +++ b/reverse-proxy/conf.d.dev/default.conf @@ -6,17 +6,20 @@ server { rewrite ^/api/archival/(.*)$ /$1 break; proxy_pass http://archival-api:80; include location-includes/*; + add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' validator.swagger.io data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';" always; } location ^~ /api/directory/ { rewrite ^/api/directory/(.*)$ /$1 break; proxy_pass http://directory-api:80; include location-includes/*; + add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' validator.swagger.io data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';" always; } location ^~ /api/ { rewrite ^/api/(.*)$ /$1 break; proxy_pass http://api-docs:8080; include location-includes/*; + add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' validator.swagger.io data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';" always; } } \ No newline at end of file diff --git a/reverse-proxy/conf.d/default.conf b/reverse-proxy/conf.d/default.conf index 12b921b2f..9f59c0416 100644 --- a/reverse-proxy/conf.d/default.conf +++ b/reverse-proxy/conf.d/default.conf @@ -9,23 +9,27 @@ server { rewrite ^/api/archival/(.*)$ /$1 break; proxy_pass http://archival-api:80; include location-includes/*; + add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' validator.swagger.io data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';" always; } location ^~ /api/directory/ { rewrite ^/api/directory/(.*)$ /$1 break; proxy_pass http://directory-api:80; include location-includes/*; + add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' validator.swagger.io data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';" always; } location ^~ /api/ { rewrite ^/api/(.*)$ /$1 break; proxy_pass http://api-docs:8080; include location-includes/*; + add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' validator.swagger.io data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';" always; } location / { proxy_pass http://web:80; include location-includes/*; + add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' validator.swagger.io data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';" always; } } diff --git a/reverse-proxy/location-includes/cors.conf b/reverse-proxy/location-includes/cors.conf deleted file mode 100644 index 93aa097f8..000000000 --- a/reverse-proxy/location-includes/cors.conf +++ /dev/null @@ -1,34 +0,0 @@ -# https://enable-cors.org/server_nginx.html -# -# Wide-open CORS config for nginx -# -if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - # - # Custom headers and headers various browsers *should* be OK with but aren't - # - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - # - # Tell client that this pre-flight info is valid for 20 days - # - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'text/plain; charset=utf-8'; - add_header 'Content-Length' 0; - include /etc/nginx/server-includes/headers.conf; - return 204; -} -if ($request_method = 'POST') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; - include /etc/nginx/server-includes/headers.conf; -} -if ($request_method = 'GET') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; - include /etc/nginx/server-includes/headers.conf; -} \ No newline at end of file diff --git a/reverse-proxy/location-includes/headers.conf b/reverse-proxy/location-includes/headers.conf new file mode 100644 index 000000000..0aa44e785 --- /dev/null +++ b/reverse-proxy/location-includes/headers.conf @@ -0,0 +1,5 @@ +add_header Referrer-Policy "no-referrer" always; +add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; +add_header X-Content-Type-Options "nosniff" always; +add_header X-Frame-Options "SAMEORIGIN" always; +add_header X-XSS-Protection "1; mode=block" always; \ No newline at end of file diff --git a/reverse-proxy/server-includes/headers.conf b/reverse-proxy/server-includes/headers.conf deleted file mode 100644 index 227cd6d32..000000000 --- a/reverse-proxy/server-includes/headers.conf +++ /dev/null @@ -1,6 +0,0 @@ -add_header Referrer-Policy "no-referrer" always; -add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; -add_header X-Content-Type-Options "nosniff" always; -add_header X-Frame-Options "SAMEORIGIN" always; -add_header X-XSS-Protection "1; mode=block" always; -add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' validator.swagger.io data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; form-action 'none'; frame-ancestors 'none';" always; \ No newline at end of file