Remote website access proxy
JavaScript
Latest commit de61cdd Jun 26, 2016 @walac walac committed on GitHub Merge pull request #5 from kristelteng/add_docs_to_whitelist
add docs.taskcluster to whitelist
Permalink
Failed to load latest commit information.
test
.babelrc Initial revision. Feb 18, 2016
.eslintrc
.gitignore Initial revision. Feb 18, 2016
.tern-project
.travis.yml Add travis-ci configuration. Mar 23, 2016
LICENSE Initial revision. Feb 18, 2016
Procfile Setup heroku app. Feb 18, 2016
README.md
npm-shrinkwrap.json Add npm-shrinkwrap Apr 21, 2016
package.json
server.js add docs.taskcluster to whitelist Jun 26, 2016

README.md

CORS Proxy

cors-proxy is a simple service to enable taskcluster frontend services to make access remote endpoints that disallow cross origin requests.

Any website under taskcluster.net domain can make remote requests through cors-proxy.

Making a request

cors-proxy exposes the /request endpoint. You make a POST request to this endpoint and in the request body, you pass the remote website request parameters, in json format.

$.ajax({
  url: 'http://cors-proxy.taskcluster.net/request',
  method: 'POST',
  contentType: 'application/json',
  data: {
    url: 'https://queue.taskcluster.net/v1/ping',
  }
}).done(function(res) {
  console.log(res);
});

The request accepts the following parameters, from which only url is required.

Paramater Description
url Remote URL to connect to
method One of the http standards verbs
headers Additional http headers to send
data Body text
rejectUnauthorized Reject if the https certifcate is not valid. Default: true.

Exposing headers

By default, the browser allows Javascript code access to only a small set of response headers. If you want to access one or more headers denied by default, you can use the X-Cors-Proxy-Expose-Headers header. You set it to the list of headers you want to access, separate by comma. On response, the cors-proxy will set the Access-Control-Expose-Headers header with the list you passed.