Skip to main content

Host at a subpath

CSP configuration

Content-Security-Policy directives to allow your NookDocs site when it's served from your own domain.

If your site sends a strict Content-Security-Policy header, it also applies to the docs served at acme.com/docs (same origin, via your reverse proxy). A too-tight policy blanks the page, drops styles, or breaks the AI assistant. Allow the directives below.

This CSP is set by the customer's own edge (Cloudflare Transform Rule/Worker, Vercel headers, or a CloudFront Response Headers Policy) — there is no NookDocs API for it. NookDocs requires script-src 'unsafe-inline' (framework hydration + inline JSON-LD; a per-request nonce works instead), style-src 'unsafe-inline' (theme tokens are inline --docs-* style attributes — nonces do NOT cover these, so 'unsafe-inline' here is unavoidable), img-src 'self' data: https:, font-src 'self' data:, and connect-src 'self' https://*.nookdocs.site for the AI assistant and search. Add frame-src hosts only for videos/iframes you actually embed.

No CSP on your domain? Nothing to do — skip this page. This only matters when you're already sending a Content-Security-Policy and now host docs under it.

Recommended directives

default-src 'self';
script-src 'self' 'unsafe-inline';
style-src 'self' 'unsafe-inline';
img-src 'self' data: https:;
font-src 'self' data:;
connect-src 'self' https://*.nookdocs.site;
frame-src 'self' https://www.youtube.com https://player.vimeo.com;
DirectiveWhy NookDocs needs it
script-src 'unsafe-inline'Framework hydration + inline JSON-LD. Use a nonce instead if you can mint one per request.
style-src 'unsafe-inline'Theme tokens (--docs-*) are applied as inline styles.
img-src data: https:Logos/favicons (data: + your assets) and any external images in your content.
font-src 'self' data:Bundled + embedded fonts.
connect-src https://*.nookdocs.siteThe AI assistant + search call back to the platform. Drop if you don't use the assistant.
frame-src ...Only if you embed videos/iframes via <Video> / <Embed>. Add the hosts you actually use.

Tightening with a nonce

'unsafe-inline' for scripts is the simple path. If your platform injects a per-request nonce, prefer:

script-src 'self' 'nonce-{REQUEST_NONCE}';

and drop 'unsafe-inline' from script-src. Styles still need 'unsafe-inline' (theme tokens are inline style attributes, which nonces don't cover).

Where to set it

  • Cloudflare — a Transform Rule or a response.headers set in the Worker.

  • Vercelheaders in vercel.json or next.config.js.

  • CloudFront — a Response Headers Policy on the /docs* behavior.

After changing the policy, hard-reload and check the browser console for blocked-resource warnings.

Was this page helpful?

Last updated August 11, 2026