webzod
account

Add base-uri to the Content-Security-Policy on nginx

headers.csp.base_uri · effort: minutes

Why it matters

An injected base tag can make every relative script URL on the page load from an attacker's server. base-uri 'self' (or 'none') stops that and almost never breaks anything.

The fix

  1. Append ; base-uri 'self' to the value of the add_header Content-Security-Policy line, run sudo nginx -t and reload.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.