A proxy to websites with CORS enabled.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
public/css
routes
test
views
.env
.eslintrc
.gitignore
.npmrc
.travis.yml
CHANGELOG.md
LICENSE
README.md
app.js
nodemon.json
package.json

README.md

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 repository.

Usage

The RESTful API is as follows:

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

Thus, if you want to make a jQuery AJAX request to http://example.com, you can do the following:

var url = 'http://example.com';
$.ajax({
  method: 'GET',
  url: 'https://corsmirror.herokuapp.com/v1/cors?url=' + url
}).done(function(data) {
  console.log(data);
});

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

$.get(
  'https://corsmirror.herokuapp.com/v1/cors' +
  '?url=http://example.com' +
  '&content-type=text/plain'
).done(function(data, status, xhr) {
  console.log(xhr.getResponseHeader('content-type'));
});

Note: 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