cloudflare · Cloudflare Workers Docs
Workers Set security headers
Implements a Cloudflare Worker to inject common security headers such as Content-Security-Policy, X-Frame-Options, and Strict-Transport-Security into HTTP responses.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Workers Set security headers
Implements a Cloudflare Worker to inject common security headers such as Content-Security-Policy, X-Frame-Options, and Strict-Transport-Security into HTTP responses.
When To Use
Use when you need to implement a middleware pattern in Cloudflare Workers to automatically apply security headers to all outgoing HTTP responses.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-examples-security-headers-set-workflow-guide.md | A guide demonstrating how to implement common security headers like Content-Security-Policy and Strict-Transport-Security using Cloudflare Workers. | Questions about a guide demonstrating how to implement common security headers like Content-Security-Policy and Strict-Transport-Secu... |
examples/workers-examples-security-headers-set-cloudflare-workers-set-security-he.text | A JavaScript example demonstrating how to intercept a fetch request in a Cloudflare Worker to inject security headers like Content-Security-Policy. | Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to intercept a fetch request in a Cloudflare Worker to inject security headers... |
examples/workers-examples-security-headers-set-cloudflare-workers-security-header.text | A JavaScript example demonstrating how to intercept fetch requests in a Cloudflare Worker to inject security headers like Content-Security-Policy. | Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to intercept fetch requests in a Cloudflare Worker to inject security headers... |
examples/workers-examples-security-headers-set-cloudflare-workers-python-set-secu.text | A Python implementation of a Cloudflare Worker that adds security headers like Content-Security-Policy to outgoing responses. | Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Worker that adds security headers like Content-Security-Policy to outgoing re... |
examples/workers-examples-security-headers-set-cloudflare-workers-rust-set-securi.text | A Rust implementation for a Cloudflare Worker that injects security headers like Content-Security-Policy into fetch responses using a HashMap. | Exact payloads, commands, or snippets shown in A Rust implementation for a Cloudflare Worker that injects security headers like Content-Security-Policy into fetch r... |
examples/workers-examples-security-headers-set-cloudflare-workers-hono-secure-hea.text | A Hono framework implementation for Cloudflare Workers that applies security headers to all incoming requests. | Exact payloads, commands, or snippets shown in A Hono framework implementation for Cloudflare Workers that applies security headers to all incoming requests. |
What This Skill Covers
- Set common security headers (X-XSS-Protection, X-Frame-Options, X-Content-Type-Options, Permissions-Policy, Referrer-Policy, Strict-Transport-Security, Conte...
- Main sections:
Tags.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/examples/security-headers
