CSP Configuration

If your infrastructure enforces Content Security Policy (CSP), you'll need to allowlist Waldium's resources for your blog to function correctly. This guide covers the domains and directives needed for proper operation.

CSP configuration is only necessary if your proxy or firewall enforces security headers that override defaults. Most setups work without additional configuration.

What is CSP?

Content Security Policy is a security standard that controls which resources a web page can load. It helps prevent cross-site scripting (XSS) attacks by whitelisting trusted sources. If your infrastructure adds CSP headers, you must include Waldium's domains for the blog to work.


CSP Directives

These directives control different resource types:

DirectivePurpose
script-srcJavaScript files that can execute
style-srcStylesheets that can be loaded
font-srcFont files that can be loaded
img-srcImages, icons, and logos
connect-srcURLs for API calls and WebSockets
frame-srcURLs that can be embedded in iframes
default-srcFallback for unspecified directives

Required Domains

Add these domains to your CSP for full Waldium functionality:

DomainPurposeDirectivesRequired
*.waldium.appBlog content and APIconnect-src, frame-srcYes
*.waldium.comDashboard and analyticsconnect-srcYes
fonts.googleapis.comGoogle Fontsstyle-src, font-srcIf using custom fonts
fonts.gstatic.comGoogle Fonts filesfont-srcIf using custom fonts

Optional Integrations

If you've enabled analytics or other integrations, include their domains:

DomainPurposeDirectives
www.googletagmanager.comGoogle Analytics/GTMscript-src, connect-src
www.google-analytics.comGoogle Analyticsscript-src, connect-src

Example CSP Header

A complete CSP for Waldium blogs:

Content-Security-Policy:
  default-src 'self';
  script-src 'self' 'unsafe-inline' 'unsafe-eval';
  style-src 'self' 'unsafe-inline' fonts.googleapis.com;
  font-src 'self' fonts.googleapis.com fonts.gstatic.com;
  img-src 'self' data: blob: *.waldium.app *.waldium.com;
  connect-src 'self' *.waldium.app *.waldium.com;
  frame-src 'self' *.waldium.app;

Only include domains for services you actually use. Remove analytics domains if you haven't configured them.


Platform-Specific Configuration

Cloudflare

Create a Response Header Transform Rule:

  1. Go to Rules > Overview in Cloudflare
  2. Click Create rule > Response Header Transform Rule
  3. Configure:
    • Modify response header: Set static
    • Header name: Content-Security-Policy
    • Header value: Your CSP policy
  4. Deploy the rule

Vercel

Add to your vercel.json:

{
  "headers": [
    {
      "source": "/blog/(.*)",
      "headers": [
        {
          "key": "Content-Security-Policy",
          "value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.googleapis.com fonts.gstatic.com; img-src 'self' data: blob: *.waldium.app *.waldium.com; connect-src 'self' *.waldium.app *.waldium.com; frame-src 'self' *.waldium.app;"
        }
      ]
    }
  ]
}

AWS CloudFront

Add a response headers policy:

{
  "ResponseHeadersPolicy": {
    "Name": "WaldiumCSP",
    "Config": {
      "SecurityHeadersConfig": {
        "ContentSecurityPolicy": {
          "ContentSecurityPolicy": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.googleapis.com fonts.gstatic.com; img-src 'self' data: blob: *.waldium.app *.waldium.com; connect-src 'self' *.waldium.app *.waldium.com; frame-src 'self' *.waldium.app;",
          "Override": true
        }
      }
    }
  }
}

Nginx

Add to your server block:

add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.googleapis.com fonts.gstatic.com; img-src 'self' data: blob: *.waldium.app *.waldium.com; connect-src 'self' *.waldium.app *.waldium.com; frame-src 'self' *.waldium.app;";

Troubleshooting

Identifying CSP Violations

CSP violations appear in your browser's developer console:

  1. Open Developer Tools (F12 or right-click > Inspect)
  2. Go to the Console tab
  3. Look for errors containing:
    • "Content Security Policy: The page's settings blocked..."
    • "Refused to load the script/stylesheet..."
    • "Refused to connect to..."

Common Issues

Fonts not loading:

  • Add fonts.googleapis.com to style-src and font-src
  • Add fonts.gstatic.com to font-src

Images broken:

  • Add *.waldium.app and *.waldium.com to img-src
  • Include data: and blob: for inline images

API calls failing:

  • Add *.waldium.app to connect-src
  • Check for additional API domains in console errors

Interactive features broken:

  • Ensure 'unsafe-inline' and 'unsafe-eval' are in script-src
  • Add any third-party domains shown in console errors

Was this page helpful?