prepare to introduce nonce support for

This commit is contained in:
2022-05-29 13:51:54 +01:00
parent 8bfefb0bcc
commit 1658af0aee

View File

@@ -1,10 +1,19 @@
set_secure_random_alphanum $cspNonce 32;
# usage
#<script nonce="**CSP_NONCE**">
#
# sub filter to ensure that the CSP NONCE is introduce
add_header Content-Security-Policy "default-src 'none'; img-src 'self'; \
script-src 'self'; style-src 'self' 'unsafe-inline'; \
script-src 'self' 'nonce-$cspNonce'; style-src 'self' 'unsafe-inline'; \
font-src 'self'; base-uri 'self'; form-action 'self';\
connect-src 'self'; frame-ancestors 'none'";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin";
add_header Strict-Transport-Security "max-age=31536000" always;
add_header Strict-Transport-Security "max-age=31536000" always;
#sub_filter_once off;
#sub_filter_types text/html; # or *
#sub_filter **CSP_NONCE** $cspNonce;