CSP 生成器

组合 Content-Security-Policy 指令。

交互控件由 JavaScript 加载。处理留在浏览器内——不会上传。

正在加载工具…

如何使用

  1. Open CSP Generator — Load the page.
  2. Select directives — Toggle sources you need.
  3. Generate header text — Copy Content-Security-Policy value.
  4. Deploy on your host — Apply via CDN/host headers.

限制

需要启用 JavaScript。极大输入可能拖慢标签页。结果取决于浏览器 API;因不上传,没有服务器端配额。

适合什么时候用

需要快速免费工具、不想注册账号、也不想把内容交给在线转换站时。

什么时候别用

需要服务端集成、大规模批处理,或有认证合规要求的专业工具时。

隐私说明

工具输入仅在浏览器本地处理。主题/语言/收藏可能使用 localStorage;托管可能保留常规访问日志(IP、UA、URL),不含工具正文。

常见问题(5)

Report-only?

You can draft Content-Security-Policy-Report-Only separately in your host config.

Nonce/hash?

Add nonces/hashes in your app; this tool helps compose directive text.

Uploaded?

No.

Breaks site?

Start in report-only, watch violations, then enforce.

Inline scripts?

Prefer nonces or hashes over 'unsafe-inline'.