Skip to content

CORSmirror/CORSmirror

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

What is CORSmirror?

CORSmirror is a RESTful API that provides a proxy to websites with CORS enabled.

The web service is built with:

For more information, check out the site, Replit, or the repository.

Usage

The RESTful API is as follows:

https://corsmirror.onrender.com/v1/cors?url=<url>

So if you want to fetch https://example.com, you can:

fetch('https://corsmirror.onrender.com/v1/cors?url=https://example.com')
  .then((response) => response.text())
  .then((data) => console.log(data));

You can pass additional query strings that sets or overrides the response header fields:

fetch(
  'https://corsmirror.onrender.com/v1/cors?url=https://example.com&content-type=text/plain'
)
  .then((response) => response.headers.get('content-type'))
  .then((data) => console.log(data));

There are certain fields like Content-Length that cannot be overridden.

Development

This is an open-source project so feel free to fork the repository and play with the server.

Contributions are welcome!

Installation

git clone https://github.com/CORSmirror/CORSmirror.git
cd CORSmirror
npm install

Run

npm run dev # development
npm start   # production

Testing

npm test
npm run lint

License

MIT