cloudflare · Cloudflare Workers Docs
Workers Auth with headers
Implements a request authorization pattern that allows or denies incoming requests by validating a pre-shared key within a specific HTTP header.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Workers Auth with headers
Implements a request authorization pattern that allows or denies incoming requests by validating a pre-shared key within a specific HTTP header.
When To Use
Use when you need to implement a simple authentication layer for a Cloudflare Worker using a pre-shared key in an HTTP header.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-examples-auth-with-headers-workflow-guide.md | A Cloudflare Workers example demonstrating how to allow or deny requests based on a pre-shared key in a request header. | Questions about a Cloudflare Workers example demonstrating how to allow or deny requests based on a pre-shared key in a request header. |
examples/workers-examples-auth-with-headers-cloudflare-workers-auth-with-headers.text | A JavaScript example demonstrating how to authenticate Cloudflare Workers requests by validating a custom pre-shared key in the request headers. | Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to authenticate Cloudflare Workers requests by validating a custom pre-shared... |
examples/workers-examples-auth-with-headers-cloudflare-workers-auth-with-headers-2.text | A JavaScript example demonstrating how to validate a pre-shared key within a custom HTTP header in a Cloudflare Worker. | Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to validate a pre-shared key within a custom HTTP header in a Cloudflare Worker. |
examples/workers-examples-auth-with-headers-cloudflare-workers-python-auth-with-h.text | A Python implementation of a Cloudflare Worker using a WorkerEntrypoint to validate a custom pre-shared key in the request headers. | Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Worker using a WorkerEntrypoint to validate a custom pre-shared key in the re... |
examples/workers-examples-auth-with-headers-cloudflare-workers-hono-auth-with-hea.text | A Hono framework implementation for Cloudflare Workers that validates a pre-shared key via a custom request header. | Exact payloads, commands, or snippets shown in A Hono framework implementation for Cloudflare Workers that validates a pre-shared key via a custom request header. |
What This Skill Covers
- Allow or deny a request based on a known pre-shared key in a header. This is not meant to replace the WebCrypto API.
- 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/auth-with-headers
