Security Headers
Security headers used to protect your application.
next-forge uses Nosecone to set HTTP response headers related to security.
Configuration
Here are the headers we have enabled:
Cross-Origin-Embedder-Policy
(COEP)Cross-Origin-Opener-Policy
Cross-Origin-Resource-Policy
Origin-Agent-Cluster
Referrer-Policy
Strict-Transport-Security
(HSTS)X-Content-Type-Options
X-DNS-Prefetch-Control
X-Download-Options
X-Frame-Options
X-Permitted-Cross-Domain-Policies
X-XSS-Protection
See the Nosecone reference for details on each header and configuration options.
Usage
Recommended headers are set by default and configured in @repo/security/middleware
. Changing the configuration here will affect all apps.
They are then attached to the response within the middleware in apps/app/middleware
and apps/web/middleware.ts
. Adjusting the configuration in these files will only affect the specific app.
Content Security Policy (CSP)
The CSP header is not set by default because it requires specific configuration based on the next-forge features you have enabled.
In the meantime, you can set the CSP header using the Nosecone configuration. For example, the following CSP configuration will work with the default next-forge features: