Jak używać: Generator Content-Security-Policy

Generator Content-Security-Policy to darmowe online narzędzie Narzędzia webowe, które build a CSP header for nginx, Apache or HTML, with warnings about unsafe-inline and unsafe-eval natychmiast w przeglądarce. Wklej dane, ustaw opcje i otrzymuj wynik na żywo — bez instalacji, rejestracji i wysyłania danych na serwer.

Użyj Generator Content-Security-Policy teraz →

Opis

Build a CSP header for nginx, Apache or HTML, with warnings about unsafe-inline and unsafe-eval.

  • Narzędzia webowe
  • Ponieważ wszystko liczy się po stronie klienta, Generator Content-Security-Policy jest bezpieczne dla danych wrażliwych.
Wejście Generator Content-Security-Policy Wyjście Działa w 100% w przeglądarce — Twoje dane nie opuszczają urządzenia.
Generator Content-Security-Policy — Wejście → Wyjście

Jak używać

Generator Content-Security-Policy w trzech krokach:

  1. Wklej dane w pole wejściowe (lub wczytaj przykład).
  2. Dopasuj opcje do docelowego formatu.
  3. Skopiuj, pobierz lub sprawdź wynik — aktualizowany na bieżąco.
Jak używać · Generator Content-Security-Policy 1 Wklej dane w polewejściowe (lub wczytajprzykład). 2 Dopasuj opcje dodocelowego formatu. 3 Skopiuj, pobierz lubsprawdź wynik —aktualizowany nabieżąco.
Jak używać

Uruchom

Przykłady

Fill in the directives; the generator emits nginx, Apache and meta-tag forms plus a Report-Only variant.

Wyjście(由工具此刻实时生成)

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.

此输出由工具真实运行产生,并非人工编写。

Zastosowania

Popularne zastosowania Generator Content-Security-Policy:

  • Build a CSP header for nginx, Apache or HTML, with warnings about unsafe-inline and unsafe-eval.

Parametry

To narzędzie nie ma opcji — działa wyłącznie na danych wejściowych.

FAQ

Czym jest Content-Security-Policy Generator?

Content-Security-Policy Generator służy do tego, by build a CSP header for nginx, Apache or HTML, with warnings about unsafe-inline and unsafe-eval. Działa w 100% w przeglądarce — dane pozostają prywatne.

Czy Content-Security-Policy Generator jest darmowe?

Tak, bez limitów, rejestracji i instalacji.

Czy moje dane są wysyłane?

Nie. Wszystko przetwarza lokalnie Twoja przeglądarka.

Warto wiedzieć

  • 全部计算在浏览器端完成,因此超大输入受限于标签页内存,而非服务器上传限制。

Powiązane narzędzia

Generator Content-Security-Policy → · Narzędzia webowe →

Użyj Generator Content-Security-Policy teraz →