Cách dùng: Bộ tạo Content-Security-Policy
Bộ tạo Content-Security-Policy là công cụ Công cụ web trực tuyến miễn phí, giúp build a CSP header for nginx, Apache or HTML, with warnings about unsafe-inline and unsafe-eval ngay trong trình duyệt. Dán dữ liệu, chỉnh tùy chọn và nhận kết quả tức thì — không cài đặt, không đăng ký, không tải lên máy chủ.
Dùng Bộ tạo Content-Security-Policy ngay →
Mô tả
Build a CSP header for nginx, Apache or HTML, with warnings about unsafe-inline and unsafe-eval.
- Công cụ web
- Vì mọi tính toán đều ở phía máy khách, Bộ tạo Content-Security-Policy an toàn với dữ liệu nhạy cảm như API key hay token.
Cách dùng
Dùng Bộ tạo Content-Security-Policy chỉ ba bước:
- Dán dữ liệu vào ô nhập (hoặc nạp ví dụ).
- Chỉnh tùy chọn theo định dạng mong muốn.
- Sao chép, tải hoặc xem kết quả — cập nhật khi bạn gõ.
Chạy
Ví dụ
Fill in the directives; the generator emits nginx, Apache and meta-tag forms plus a Report-Only variant.
Đầu ra(由工具此刻实时生成)
Content-Security-Policy default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self'; font-src 'self' data:; frame-src 'none'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests nginx add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self'; font-src 'self' data:; frame-src 'none'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests" always; Apache (.htaccess) Header always set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self'; font-src 'self' data:; frame-src 'none'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests" HTML meta tag <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self'; font-src 'self' data:; frame-src 'none'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests"> Report-only variant (test without breaking the site) Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self'; font-src 'self' data:; frame-src 'none'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests ⚠ Review before deploying • No report-uri/report-to set — you will not learn about violations in production. Always deploy with Report-Only first and watch the console for violations.
此输出由工具真实运行产生,并非人工编写。
Tình huống sử dụng
Những tình huống phổ biến mà Bộ tạo Content-Security-Policy hữu ích:
- Build a CSP header for nginx, Apache or HTML, with warnings about unsafe-inline and unsafe-eval.
Tham số
Công cụ này không có tùy chọn — chỉ tác động lên đầu vào.
FAQ
Content-Security-Policy Generator là gì?
Content-Security-Policy Generator dùng để build a CSP header for nginx, Apache or HTML, with warnings about unsafe-inline and unsafe-eval. Chạy hoàn toàn trong trình duyệt nên dữ liệu của bạn được bảo mật.
Content-Security-Policy Generator có miễn phí không?
Có. Không giới hạn, không đăng ký, không cài đặt.
Dữ liệu của tôi có bị tải lên?
Không. Mọi xử lý diễn ra ngay trên máy bạn.
Cần lưu ý
- 全部计算在浏览器端完成,因此超大输入受限于标签页内存,而非服务器上传限制。