forked from colin/resume
2
0
Fork 0
revert points!!!
This commit is contained in:
colin 2024-11-11 23:04:26 -05:00
parent 143228b112
commit 18152f7d2a
1 changed files with 9 additions and 10 deletions

View File

@ -1,4 +1,7 @@
# Use $request_id as a pseudo-nonce for Content Security Policy (CSP)
# $request_id is unique per request and will serve as a nonce value here.
# Map $request_id to a variable named $nonce
map $request_id $nonce {
default "$request_id";
}
@ -16,6 +19,7 @@ server {
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), accelerometer=(), gyroscope=(), magnetometer=(), payment=(), usb=()" always;
# Content Security Policy (CSP) with injected $nonce for script-src
# Allows inline scripts that match the nonce generated for each request
add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'nonce-$nonce' https://matomo.nixc.us; style-src 'self' 'unsafe-inline' https://colinknapp.com; img-src 'self' https://matomo.nixc.us https://colinknapp.com https://hedgedoc.nixc.us; font-src 'self' data:; frame-ancestors 'self'; base-uri 'self'; form-action 'self';" always;
# Cross-origin isolation headers
@ -23,21 +27,16 @@ server {
add_header Cross-Origin-Resource-Policy "same-origin" always;
add_header Cross-Origin-Opener-Policy "same-origin" always;
# Subresource Integrity (SRI) requires modifying HTML for each script link to include integrity hashes
# Set up sub_filter to add nonce to inline scripts
# Use sub_filter to inject the nonce into inline <script> tags automatically
# This works for HTML responses where <script> tags are inline in the HTML
sub_filter '<script>' '<script nonce="$nonce">';
sub_filter_once off;
sub_filter_types text/html;
sub_filter_once off; # Apply the replacement to all instances of <script> tags
sub_filter_types text/html; # Only apply the sub_filter to HTML content
# Redirect demo.hedgedoc.org resources to hedgedoc.nixc.us
# Redirect demo.hedgedoc.org resources to hedgedoc.nixc.us for compatibility
sub_filter "https://demo.hedgedoc.org" "https://hedgedoc.nixc.us";
# Expect-CT Header
add_header Expect-CT "max-age=86400, enforce" always;
# Cache-Control for dynamic pages
location / {
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
try_files $uri $uri/ =404;
}
}