Skip to content
On this page

Quickly inspect headers from any API

A simple Cloudflare worker to query headers of remote urls from client.

This is useful to check for CORS headers, x-frame-options, etc. before embedding a website in an iframe or using it in a website. Doing this prevents unnecessary errors in the console.

Sample usage:

https://header-inspector.r2cache.com/?apiurl=https://example.com&headers=*

json
{
  "url": "https://example.com",
  "origin": "https://example.com",
  "method": "HEAD",
  "headers": {
    "age": "387750",
    "cache-control": "max-age=604800",
    "cf-cache-status": "DYNAMIC",
    "cf-ray": "8b925cbd75046fb4-CDG",
    "connection": "keep-alive",
    "content-type": "text/html; charset=UTF-8",
    "date": "Mon, 26 Aug 2024 08:13:23 GMT",
    "expires": "Mon, 02 Sep 2024 08:13:23 GMT",
    "last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
    "server": "cloudflare",
    "x-cache": "HIT"
  }
}

?apiurl=https://example.com&headers=etag,content-type

?apiurl=https://example.com&headers=x-frame-options,access-control-allow-origin

CORS headers would be set to * in the response, so it can be used in websites to check CORS for other websites.

Worker Code on Github Gist -

Made with ❤️ using the awesome vitepress