19 lines
732 B
Plaintext
19 lines
732 B
Plaintext
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' '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;
|
|
|
|
#sub_filter_once off;
|
|
#sub_filter_types text/html; # or *
|
|
#sub_filter **CSP_NONCE** $cspNonce; |