cors-backdoor

1.0.6 • Public • Published

cors-backdoor

A CORS-friendly local proxy to access cross origin resources

Version Downloads License Known Vulnerabilities


A temporary workaround for common CORS errors like:

 
Access to fetch at 'http://api.example.com/posts' from origin 'http://localhost:8082' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
 
Access to fetch at 'http://api.example.com/posts' from origin 'http://localhost:8082' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

Installation

Install as a global module (recommended)

npm install -g cors-backdoor

Install as a dev dependency

npm install -D cors-backdoor

Quick Start

cors-backdoor --target http://api.example.com

This will start a local proxy running on the port 1234 for the target http://api.example.com. The client will have to be reconfigured to make requests which looked like http://api.example.com/posts to http://localhost:1234/posts instead

Documentation

CLI API, Advanced configuration and more on the docs page https://drishtilabs.github.io/cors-backdoor

Package Sidebar

Install

npm i cors-backdoor

Weekly Downloads

1,269

Version

1.0.6

License

MIT

Unpacked Size

695 kB

Total Files

47

Last publish

Collaborators

  • cravindra