From 9332c951266e2c7a363b3f24c33c89064a88d677 Mon Sep 17 00:00:00 2001 From: DDATAA <45762540+Ddataa@users.noreply.github.com> Date: Thu, 20 Oct 2022 15:02:02 +0000 Subject: [PATCH] Update nginx.conf --- conf/nginx.conf | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 4b3a779..9a7b2bb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,12 +4,12 @@ set $allowed_origins "https://${sandbox_domain}"; set $api_domain "api.__DOMAIN__"; set $files_domain "files.__DOMAIN__"; ssl_ecdh_curve secp384r1; -add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; -add_header X-XSS-Protection "1; mode=block"; -add_header X-Content-Type-Options nosniff; -add_header Access-Control-Allow-Origin "${allowed_origins}"; -add_header Cross-Origin-Resource-Policy cross-origin; -add_header Cross-Origin-Embedder-Policy require-corp; +more_set_headers Strict-Transport-Security "max-age=31536000; includeSubDomains" always; +more_set_headers X-XSS-Protection "1; mode=block"; +more_set_headers X-Content-Type-Options nosniff; +more_set_headers Access-Control-Allow-Origin "${allowed_origins}"; +more_set_headers Cross-Origin-Resource-Policy cross-origin; +more_set_headers Cross-Origin-Embedder-Policy require-corp; root /var/www/cryptpad; index index.html; error_page 404 /customize.dist/404.html; @@ -19,7 +19,7 @@ if ($uri ~ ^(\/|.*\/|.*\.html)$) { if ($args ~ ver=) { set $cacheControl max-age=31536000; } -add_header Cache-Control $cacheControl; +more_set_headers Cache-Control $cacheControl; set $styleSrc "'unsafe-inline' 'self' https://${main_domain}"; set $connectSrc "'self' https://${main_domain} blob: wss://${api_domain} https://${sandbox_domain}"; set $fontSrc "'self' data: https://${main_domain}"; @@ -38,7 +38,7 @@ if ($uri ~ ^\/unsafeiframe\/inner\.html.*$) { set $unsafe 1; } if ($unsafe) { set $scriptSrc "'self' 'unsafe-eval' 'unsafe-inline' resource: https://${main_domain}"; } -add_header Content-Security-Policy "default-src 'none'; child-src $childSrc; worker-src $workerSrc; media-src $mediaSrc; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc; frame-ancestors $frameAncestors"; +more_set_headers Content-Security-Policy "default-src 'none'; child-src $childSrc; worker-src $workerSrc; media-src $mediaSrc; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc; frame-ancestors $frameAncestors"; location ^~ /cryptpad_websocket { proxy_pass http://localhost:3000; proxy_set_header X-Real-IP $remote_addr; @@ -61,31 +61,31 @@ location ~ ^/api/.*$ { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_hide_header Cross-Origin-Resource-Policy; - add_header Cross-Origin-Resource-Policy cross-origin; + more_set_headers Cross-Origin-Resource-Policy cross-origin; proxy_hide_header Cross-Origin-Embedder-Policy; - add_header Cross-Origin-Embedder-Policy require-corp; + more_set_headers Cross-Origin-Embedder-Policy require-corp; } location ^~ /blob/ { if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' "${allowed_origins}"; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'application/octet-stream; charset=utf-8'; - add_header 'Content-Length' 0; + more_set_headers 'Access-Control-Allow-Origin' "${allowed_origins}"; + more_set_headers 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + more_set_headers 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + more_set_headers 'Access-Control-Max-Age' 1728000; + more_set_headers 'Content-Type' 'application/octet-stream; charset=utf-8'; + more_set_headers 'Content-Length' 0; return 204; } - add_header X-Content-Type-Options nosniff; - add_header Cache-Control max-age=31536000; - add_header 'Access-Control-Allow-Origin' "${allowed_origins}"; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Content-Length'; - add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Content-Length'; + more_set_headers X-Content-Type-Options nosniff; + more_set_headers Cache-Control max-age=31536000; + more_set_headers 'Access-Control-Allow-Origin' "${allowed_origins}"; + more_set_headers 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + more_set_headers 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Content-Length'; + more_set_headers 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Content-Length'; try_files $uri =404; } location ^~ /block/ { - add_header X-Content-Type-Options nosniff; - add_header Cache-Control max-age=0; + more_set_headers X-Content-Type-Options nosniff; + more_set_headers Cache-Control max-age=0; try_files $uri =404; } location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard|file|media|profile|contacts|todo|filepicker|debug|kanban|sheet|support|admin|notifications|teams|calendar|presentation|doc|form|report|convert|checkup)$ {