Response Headers
Inspect HTTP response headers for any URL from the edge
Fetch any URL and return its HTTP status and response headers as JSON.
API Reference
GET /headers
Uses HEAD first and falls back to GET when the origin does not support HEAD.
Prop
Type
Example Request
curl "https://your-worker.workers.dev/headers?url=https://www.cloudflare.com"Success Response
url string
Final URL after redirects
statusCode number
HTTP status code
statusText string
HTTP status text
method string
HEAD or GET
headers object
Response headers as key/value pairs
{
"url": "https://www.cloudflare.com/",
"statusCode": 200,
"statusText": "OK",
"method": "HEAD",
"headers": {
"content-type": "text/html; charset=utf-8",
"server": "cloudflare"
}
}Error Codes
400- Missing or invalidurl(INVALID_URL)502- Fetch failed (FETCH_ERROR)
Use Cases
- Debug cache and security headers from the edge
- Compare response headers across origins
- Learn HEAD vs GET fallback patterns in Workers
Limitations
- Uses HEAD with GET fallback; some origins return different headers per method
- Single URL per request
- Fetch timeout on slow origins
Deployment
Test your deployment
curl "https://your-worker.workers.dev/headers?url=https://www.cloudflare.com"Local Development
cd apps/experiments/response-headers
npm install
npm run dev