ToolPal

Generador CSP

Genera encabezados Content Security Policy (CSP) para tu sitio web. Configura directivas con niveles de seguridad predefinidos, añade fuentes personalizadas y copia el valor completo del encabezado.

Preajustes de seguridad

default-src

Fallback for other directives

script-src

JavaScript sources

style-src

Stylesheet sources

img-src

Image sources

font-src

Font sources

connect-src

AJAX, WebSocket, fetch

frame-src

Iframe sources

object-src

Plugin sources

media-src

Audio/video sources

worker-src

Web Worker sources

Opciones adicionales

Encabezado CSP generado

Content-Security-Policy:
default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-src 'none'; object-src 'none'

¿Qué es CSP?

Content Security Policy es un encabezado de respuesta HTTP que ayuda a prevenir ataques XSS e inyección de datos. Añádelo como encabezado de respuesta: Content-Security-Policy: [valor]

Cómo usar

Genera encabezados Content Security Policy (CSP) para tu sitio web. Configura directivas con niveles de seguridad predefinidos, añade fuentes personalizadas y copia el valor completo del encabezado.

  1. 1Choose a security preset — Strict, Moderate, or Open — based on your site's needs. Strict blocks nearly everything except your own domain; Moderate is good for most sites; Open allows more third-party resources.
  2. 2Configure directives by clicking the source chips to toggle them on/off. Add custom domains using the text input — useful for CDNs, analytics services, and payment processors.
  3. 3Enable extra options: upgrade-insecure-requests to automatically upgrade HTTP to HTTPS, and block-all-mixed-content to block HTTP resources on HTTPS pages. Add a report-uri to collect CSP violations.
  4. 4Click Copy to get the CSP value. Add it to your server as the Content-Security-Policy response header. Test in report-only mode first using Content-Security-Policy-Report-Only.

Características

  • Visual directive builder — toggle sources with clickable chips instead of typing raw strings
  • Security level presets — Strict, Moderate, and Open presets based on real-world security recommendations
  • Custom source support — add any domain, URL pattern, or CSP keyword for CDNs, fonts, and analytics
  • Extra security directives — one-click toggles for upgrade-insecure-requests, block-all-mixed-content, and report-uri

Preguntas frecuentes

Más información