Introduction
DocLayer‑powered applications are usually exported as mostly static HTML (prerender) with a thin API layer only where needed (adapters). Security is layered to match that model: strong browser‑side protections everywhere, plus server‑side safeguards where requests actually hit Nitro - not features that assume every page is rewritten on each request.
This page summarizes what we ship, why it looks this way, and how far you still need your own judgment when you add custom integrations.
Be noted that exact limits, CSP tokens, proxy paths, and environment variable names change between releases and are visible in shipped code for anyone cloning the repo. You should treat any initial setting here as an architectural decision, not as a covert checklist to rely on.
Nevertheless, internal /_nuxt/** and /api/adapter/** routes, within your published bundle should be protected. Always remember to not put real secrets into NUXT_PUBLIC values or Markdown.
What's under the hood
DocLayer ships Nuxt Security with its defaults and merges a DocLayer-maintained preset into the application's Nuxt security configuration. Anything you declare in nuxt.config.ts for security still wins where it overlaps - nothing here replaces your responsibility to tighten policy for bespoke entry points. You are the one who control the security setup.
The approach is designed to follow well-established patterns for headers and middleware - such as CSP-focused defaults and sensible framing practices - without enforcing strict settings that often break documentation sites relying on CDN assets, custom fonts, icons, or optional assistant features.
Static‑first deployments ship most URLs as plain files served from CDN or static hosting. For those URLs there is usually no server rewriting HTML on each request, so tooling that relies on cookie-bound CSRF with a rotating token fused into every SSG response is an awkward fit, mainly unnecessary unless you deliberately engineer for it.
DocLayer therefore leans toward:
| Layer | Fits static model because … |
|---|---|
| Response headers & CSP | Browsers enforce them on whatever origin serves HTML and assets - even when those files are CDN-cached snapshots. |
| SSG options | Nuxt Security can align hashing and export behavior with how static payloads are emitted. |
| API-facing middleware | Applies where Nitro executes runtime handlers - not on every immutable doc page slug. |
Most readers only touch HTML, JS, CSS, images, or static search index payloads. Anything that triggers authenticated writes or integrations (adapters) deserves your own pairing of narrow routes, quotas, verification, secrets, monitoring - implementations must evolve.
What the preset includes
Nuxt Security’s default settings include standard security headers - like those for framing, referrer policy, MIME type enforcement, and feature policy scaffolding - which DocLayer builds upon (see Nuxt Security documentation for details).
DocLayer customizes the Content Security Policy (CSP) to make sure that documentation sites function smoothly out of the box. This means Markdown images from external sources, web fonts from CDNs, icon libraries, and (when enabled) machine learning workers for assistant features will all work. Development conveniences like localhost / HMR support are also included, but strict: true is not enabled by default for everyone, to avoid breaking the typical static-friendly setup.
Request shaping
DocLayer provides common security features like rate limiting, blocking large requests, restricting uncommon HTTP methods, and setting CORS to your site's origins.
Note that we don't list exact rate limits, paths, or environment variable names here. Always check the shipped @vuehouse/dl preset in your project for current settings, as these can change between releases.
Nitro caching vs. safeguards
DocLayer uses Nitro routeRules to make assets, docs, and APIs as fast and secure as possible. Static files are delivered quickly, while API and integration routes get extra protection through stricter limits you can adjust in your config.
Takeover
Here's what stays yours regardless of the DocLayer preset:
| Responsibility | Owner |
|---|---|
|
|
third-party CSP allow-lists | Application's |
server secrets | Hosts / API-based secret managers, never tracked env samples in docs repos. |
duplicate headers CDNs inject | Your CDN / Proxy vendor. |
To adjust any part of the security module configuration, modify the nuxt.config.ts file in your project. The provided preset serves as a foundation, but you retain full control over your application's security setup.
Before production sanity checks
Make sure your public URLs match the origins set in your CORS settings to avoid unexpected issues between staging and production.
Anything new needs policy review. Anything that runs on the server after export can be a security risk. Static Markdown is usually safe - risks might come from extra integrations (adapters) you add.
Pre-post-mortem
Bottom line, DocLayer’s security story is tuned for static-first documentation realism - broad HTTP hygiene at the edge plus concentrated enforcement where Nitro still runs - with explicit documentation boundaries so we do not advertise implementation-level techniques for scripted abuse.
