CSP 头生成器 — 内容安全策略构建器
使用交互式编辑器构建 Content-Security-Policy 头,防御 XSS 攻击。
Presets
Directives
Additional Directives
upgrade-insecure-requestsInstructs browsers to upgrade HTTP requests to HTTPS
block-all-mixed-contentPrevents loading any mixed content (HTTP on HTTPS pages)
# Configure directives above to generate your CSP header...
What is a CSP Generator?
A Content-Security-Policy generator helps you build CSP headers that protect your website from XSS, data injection, and other code injection attacks.
How to Use
- Select a preset or start from scratch
- Configure each directive
- Add trusted sources
- Copy the CSP header
Use Cases
- Preventing XSS attacks
- Meeting security compliance
- Configuring Content-Security-Policy
- Testing CSP rules