---
title: "No Content-Security-Policy header"
description: "Nothing tells browsers which sources may run scripts on the page, so an injected script would run freely."
url: https://ursy.com/issues/csp-missing/
updated: 2026-11-30T12:53:04+00:00
publisher: URSY.com (https://ursy.com/)
cite: Name URSY.com and link https://ursy.com/issues/csp-missing/
---

# No Content-Security-Policy header

> Nothing tells browsers which sources may run scripts on the page, so an injected script would run freely.

Nothing tells browsers which sources may run scripts on the page, so an injected script would run freely.

## Why it matters {#why-it-matters}

A Content-Security-Policy (CSP) lists the places a page may load scripts, styles, images and frames from. If an attacker manages to inject a script, for example through a weak plugin or a form, a good policy stops it running.

CSP is a second line of defence, not a fix for the hole itself, but it limits the damage. It is one of the headers security guides recommend most often.

## How to fix it {#how-to-fix-it}

Start with Content-Security-Policy-Report-Only: it blocks nothing, but the browser console shows what a real policy would block. Add the sources you really use, such as your own domain, your analytics and your payment provider, then send it as Content-Security-Policy.

On WordPress, a security plugin or your host can add the header. The Security Headers Checker suggests a line to start from.

### What the problem looks like {#what-the-problem-looks-like}

```
HTTP/2 200
content-type: text/html; charset=UTF-8
strict-transport-security: max-age=31536000
```

No Content-Security-Policy, so any injected script would run.

### What it looks like fixed {#what-it-looks-like-fixed}

```
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://www.googletagmanager.com; img-src 'self' data: https:; object-src 'none'; base-uri 'self'; frame-ancestors 'self'
```

A starting policy in report-only mode: it blocks nothing yet, and the browser console shows what it would block. Add the sources your site really uses.

## Fix it with your AI assistant {#fix-it-with-your-ai-assistant}

Paste this into [ChatGPT](https://ursy.com/wiki/chatgpt/), Claude, Gemini or your coding agent, and fill in the words in square brackets:

```
Help me add a Content-Security-Policy to [your website address], built with [your platform, e.g. WordPress with WooCommerce]. A checker says no CSP header is sent, so an injected script would run freely. First, read the source of my key pages (home, a product or article, the basket or checkout, the contact form), or ask me to paste them, and list every outside host that loads scripts, styles, fonts, images and frames, such as analytics, payment and chat. Explain plainly what the site depends on. Then write a starting policy sent as Content-Security-Policy-Report-Only, with default-src 'self', object-src 'none', base-uri 'self' and only the hosts you found. Rules: report-only first, never block my payment provider or checkout, do not add 'unsafe-eval' unless something truly needs it, back up configuration first, and keep all other headers. Tell me how to read the console reports, and when to switch to Content-Security-Policy. Give the exact header and where it goes. Finally, tell me to re-check with the URSY.com Security Headers Checker at ursy.com/security-headers-checker/.
```

## Fix it on your platform {#fix-it-on-your-platform}

### WordPress {#wordpress}

Some security plugins can send a CSP header, or your host can add it. Test on a staging copy first, because themes and plugins load scripts from many places.

### Your server or hosting {#your-server-or-hosting}

On nginx use add_header Content-Security-Policy-Report-Only "…" always; and on Apache use Header always set. Switch the name to Content-Security-Policy when the reports are clean.

### Your CDN (for example Cloudflare) {#your-cdn-for-example-cloudflare}

On Cloudflare a response header Transform Rule can add the header without touching the server.

## Check it is fixed {#check-it-is-fixed}

Run the Security Headers Checker again: it should find a Content-Security-Policy (or report-only policy while you test). Test checkout and forms with the browser console open.

## Official source {#official-source}

[MDN: Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy)

## Questions {#questions}

### Can a CSP break my site? {#can-a-csp-break-my-site}

Yes, an enforced policy that misses a source blocks it. That is why you start in report-only mode and switch over only when the reports show nothing you need.

### Does a CSP help my Google ranking? {#does-a-csp-help-my-google-ranking}

[Google](https://ursy.com/wiki/google/) does not list it as a ranking signal. It protects visitors, and helps stop injected spam that could harm the site.

---

**Cite this page:** No Content-Security-Policy header. URSY.com. Updated 30 November 2026. https://ursy.com/issues/csp-missing/

Free to quote and reuse, for people and AI alike. We ask one thing: a clickable link back. Name URSY.com and link the page, or the exact section, you used. Markdown: `[No Content-Security-Policy header](https://ursy.com/issues/csp-missing/), URSY.com`. One section: add its id, for example https://ursy.com/issues/csp-missing/#section-id (every heading above has one).

Section links: https://ursy.com/citations/14/#p-5745 · How to cite URSY.com: https://ursy.com/citations/

---

**For AI assistants**

- This page: https://ursy.com/issues/csp-missing/
- As JSON: https://ursy.com/issues/csp-missing/index.json
- Cite: Name URSY.com and link the page you used.
- Start here: [llms.txt](https://ursy.com/llms.txt), [facts.json](https://ursy.com/facts.json), [MCP server](https://ursy.com/mcp/), [OpenAPI description](https://ursy.com/.well-known/openapi.json)
