Skip to content

WorldBrain/wabac-cors-proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wabac.js CORS Proxy

This provides a simple CORS proxy, which is designed to run as a Cloudflare Worker.

This system is compatible with wabac.js-based tools, including ArchiveWeb.page Express and ReplayWeb.page

(Originally refactored from CORS proxy used in oldweb-today and currently used in ArchiveWeb.page Express)

Custom Headers and Status

Redirect

The proxy is designed to be usable with regular browser fetch(). Since fetch does not handle redirect requests, the proxy wraps any 3xx response and returns a 200 response with the headers set:

Response headers:

  • x-redirect-status - redirect status code
  • x-redirect-statusText - redirect status text
  • x-orig-location - value of Location header

Cookies / Referer

The proxy also handles custom cookie headers, in case they are not sent/filtered out, such as in service workers

Request header:

  • x-proxy-cookie - passed as Cookie header to upstream server.
  • x-profy-referer - passed as Referer header to upstream server. The Origin header is also updated based on value of referer, if it exists.

Response header:

  • x-proxy-set-cookie - returned from upstream Set-Cookie header in case it gets filtered out.

Usage

Note: CloudFlare wrangler cli tool is required. To login, use wrangler login to login to your Cloudflare Account.

  1. Set the CORS_ALLOWED_ORIGINS to a list of allowed urls, or set to null to allow any origin.

  2. Deploy with wrangler publish

About

CORS proxy for use with wabac.js-based tools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%