Herramientas SEO

Generador de politica CSP para sitios estáticos

Genera una cabecera Content-Security-Policy para sitios estáticos con opciones de CDN, analiticas, fuentes y embebidos.

Cargando herramienta...

Qué es Generador de politica CSP para sitios estáticos?

Generador de politica CSP para sitios estáticos es una herramienta de navegador para esta tarea: Genera una cabecera Content-Security-Policy para sitios estáticos con opciones de CDN, analiticas, fuentes y embebidos. La salida es fácil de revisar antes de usarla en un sitio publicado.

Quick answer

A Content Security Policy blocks cross-site scripting and data injection attacks by restricting which resources the browser can load. Start with a restrictive policy and widen only when needed.

Limitations

  • CSP does not protect against server-side vulnerabilities or compromised third-party libraries already included in the policy.
  • Inline event handlers and javascript: URLs are blocked unless 'unsafe-inline' or a hash/nonce is set.
  • GitHub Pages does not support custom HTTP headers; use a meta tag-based CSP instead, which has limited directive support compared to the HTTP header.

Cómo usar esta herramienta

  1. Abre la herramienta y escribe los valores necesarios.
  2. Revisa la salida en el panel de resultado.
  3. Copia solo la parte que encaja con tu página.
  4. Prueba el cambio antes de publicar.

Para qué puedes usarla

  • Resolver tareas repetidas de publicación con menos fricción.
  • Preparar marcado, CSS o checklists antes del lanzamiento.
  • Evitar pequeños errores comunes en sitios estáticos.

Errores comunes

  • Copiar la salida sin revisarla.
  • Usar URLs locales en lugar de URLs públicas finales.
  • No confirmar que el archivo esté en la carpeta publicada.

Verification

  1. Deploy the CSP in report-only mode first by using Content-Security-Policy-Report-Only and check the browser console for violation reports.
  2. Switch to the enforce header only after confirming no legitimate resources are being blocked.

Comparison

CSP vs Permissions-Policy vs Referrer-Policy

AspectContent-Security-PolicyPermissions-PolicyReferrer-Policy
What it controlsWhich resources (scripts, styles, images, fonts) the page can load and from which originsWhich browser features (camera, microphone, geolocation, payment) the page can accessHow much referrer information is sent when the page navigates to or loads a resource from another origin
Example directivesdefault-src 'self'; script-src 'self' cdn.example.com; img-src *camera=(), geolocation=(self), fullscreen=*strict-origin-when-cross-origin, no-referrer, same-origin
Delivered as header or metaBoth. HTTP header is preferred. Meta tag works but does not support frame-ancestors or report-uri.HTTP header only. Meta tag is not supported for Permissions-Policy.Both. Meta tag works and is commonly used for static pages.
What happens if misconfiguredResources are blocked. The page may appear broken with missing styles, scripts, or images.Features silently fail. JavaScript calls to blocked APIs throw without visible browser UI.Referrer data is sent with unintended detail or is missing when analytics need it.

CSP controls resource loading, Permissions-Policy controls feature access, and Referrer-Policy controls referrer data sent to other origins. They are complementary security headers that serve different purposes.

FAQ

Preguntas sobre Generador de politica CSP para sitios estáticos

Generador de politica CSP para sitios estáticos funciona localmente?

Si. Las herramientas actuales están pensadas para generar salida en el navegador.

Debo probar el resultado?

Si. Revisa siempre la salida en tu plantilla, navegador y hosting.

Herramientas relacionadas

Más herramientas seo

Prueba también

Prueba también