Security headers › Permissions-Policy
How to add the Permissions-Policy header in Next.js
Permissions-Policy turns browser features such as camera, microphone and geolocation on or off for your site and any embedded frames.
Next.js configuration (next.config)
async headers() {
return [
{
source: "/:path*",
headers: [{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" }],
},
];
}Add the headers() function to your Next.js config and restart or redeploy. Headers set by a proxy or CDN in front can override these.
Before you deploy
Only disable features you do not use. List each feature your site needs with an allowlist such as camera=(self).
Verify it works
curl -sI https://your-site.com | grep -i permissions-policyOr run a free Korrali Web scan to check this and every other security header at once.