How to add a content security policy
In this guide, we explain how to add a Content Security Policy (CSP) to your Framer site to enhance security.
FAQ
How do I add a Content Security Policy (CSP) to my Framer site?
To add a Content Security Policy (CSP) to your Framer site, insert the CSP meta tag at the start of the head tag using custom code. Make sure all additional scripts are inserted after the meta tag, as the policy will apply to everything following the tag.
Should I use a CSP meta tag or an HTTP header for better performance?
For better performance, configure the CSP via HTTP headers — the recommended way is to use Custom Headers (Advanced Hosting), or alternatively set up a reverse proxy. Adding the CSP via a meta tag works similarly but may result in slightly worse site performance, especially in Chrome-based browsers.
Are there any tools or tips for generating a CSP for my Framer site?
You can use a tool like Report URI to generate a CSP tailored to your site's needs. Additionally, avoid using example CSPs from screenshots, as they may break your site.
Updated
