GitHub Available on GitHub:  →  https://github.com/harrisonkong/skycors

Try it yourself!

Use this interactive demo to see how CORS policy can make an API request impossible.

It also shows how the skyCORS server fixes the problem by just changing ONE line of code.

This demo fetches a 7-days weather forecast.

(select a city to auto generate URL)
(select a city to auto generate URL)

Eurorbit See skyCORS in a complete website, visit:  →  Eurorbit

What it is

A lightweight, Node.js CORS proxy server built to bypass Cross-Origin Resource Sharing (CORS) restrictions during development or production, when requests originate from web browsers.

What is CORS?

CORS is a browser security feature that restricts web pages from requesting data from a different domain or origin than the one that the page originated from.

While SOP (Same Origin Policy) simply restricts resource sharing to the same origin only, CORS provides a controlled way to share resources across different origins.

CORS Mechanism

Note: CORS only applies to browser originated requests (does not apply to URLs directly typed into the address bar)

How skyCORS solves it

This is why we can build a proxy server to act as the middleware to request the resource on behalf of the browser client. The proxy server can then add the necessary permission in the HTTP header before returning to the browser client, therefore, bypassing the restriction.

CORS Proxy Server

Real-world uses

Examples:

  • Stock tickers - used by financial sites to retrieve stock ticker data
  • Weather tickers - this server is what makes the weather ticker on this website possible. You can also visit:  →  Eurorbit to see a complete weather site using skyCORS.

Features

  • CORS Header Injection: Automatically sets Access-Control-Allow-Origin to incoming requests.
  • Dynamic Routing: Dynamically proxies requests to any target URL passed via query parameters.
  • Lightweight: Minimal dependencies ensuring fast execution and low memory overhead.
  • Controlled Access you can choose to allow all origins or a list of allowed origins.
  • Versatile: Can run locally for development or on cloud platform virtual machines (e.g. AWS) or as Cloudflare workers.

Running skyCORS

skyCORS is designed to run either as a Node.js module or a Cloudflare Worker. The environment is detected automatically.

Screenshot node Module Screenshot Cloudflare Worker

Check it out on GitHub

GitHub →  https://github.com/harrisonkong/skycors