CSP directives
The following CSP directives are used to control which resources can be loaded:script-src
: Controls which scripts can be executedstyle-src
: Controls which stylesheets can be loadedfont-src
: Controls which fonts can be loadedimg-src
: Controls which images, icons, and logos can be loadedconnect-src
: Controls which URLs can be connected to for API calls and WebSocket connectionsframe-src
: Controls which URLs can be embedded in frames or iframesdefault-src
: Fallback for other directives when not explicitly set
Domain whitelist
Domain | Purpose | CSP directive | Required |
---|---|---|---|
d4tuoctqmanu0.cloudfront.net | KaTeX CSS, fonts | style-src , font-src | Required |
*.mintlify.dev | Documentation content | connect-src | Required |
d3gk2c5xim1je2.cloudfront.net | Icons, images, logos | img-src | Required |
www.googletagmanager.com | Google Analytics/GTM | script-src , connect-src | Optional |
cdn.segment.com | Segment analytics | script-src , connect-src | Optional |
plausible.io | Plausible analytics | script-src , connect-src | Optional |
tag.clearbitscripts.com | Clearbit tracking | script-src | Optional |
cdn.heapanalytics.com | Heap analytics | script-src | Optional |
chat.cdn-plain.com | Plain chat widget | script-src | Optional |
chat-assets.frontapp.com | Front chat widget | script-src | Optional |
Example CSP configuration
Only include domains for services that you use. Remove any analytics domains that you have not configured for your documentation.
Common configurations by proxy type
Most reverse proxies support adding custom headers.Cloudflare configuration
Create a Response Header Transform Rule:- In your Cloudflare dashboard, go to Rules > Overview.
- Select Create rule > Response Header Transform Rule.
- Configure the rule:
- Modify response header: Set static
- Header name:
Content-Security-Policy
- Header value:
- Deploy your rule.
AWS CloudFront configuration
Add a response headers policy in CloudFront:Vercel configuration
Add to yourvercel.json
:
Troubleshooting
Identify CSP violations in your browser console:- Open your browser’s Developer Tools.
- Go to the Console tab.
- Look for errors starting with:
Content Security Policy: The page's settings blocked the loading of a resource
Refused to load the script/stylesheet because it violates the following Content Security Policy directive
Refused to connect to because it violates the following Content Security Policy directive