Bypass CORS (Cross-Origin Resource Sharing) policies of a remote server. This tool is particularly useful for development purposes when working with APIs that don't provide the necessary CORS headers for local development.
Warning: Use responsibly! Only use this for legal and legitimate purposes. Bypassing CORS on servers without permission can be illegal and unethical.
When you set SERVER_NAME
to a specific value, any route accessed on this tool will map directly to the same route on the specified server. For example:
If SERVER_NAME
is set to https://www.example.com
, accessing
https://localhost:3000/hello/world.json
in your browser or through
a tool will fetch and return the content
from https://www.example.com/hello/world.json
. The file, along with its path, will be stored locally. Thus, upon subsequent requests, there will be no call to https://www.example.com
.
-
Clone the repository:
git clone https://github.com/Miorey/bypass-cors-policies cd bypass-cors-policies
-
Modify the
.env
file and set theSERVER_NAME
to the server from which you wish to bypass CORS:SERVER_NAME="https://www.example.com"
-
Install the necessary Node version using nvm:
nvm install nvm use
-
Install dependencies:
npm ci
-
Start the application:
npm start
-
Modify the
docker-compose.yml
file and set theSERVER_NAME
environment variable:version: '3' services: bypass-cors-policies: image: miorey/bypass-cors-policies environment: - SERVER_NAME=https://www.example.com volumes: - ./storage:/usr/src/app/storage ports: - "3001:3000"
By default, the timout to the remote call is 2sec this value can be change through TIMEOUT
env var
- Run the Docker Compose:
docker-compose up
Files are stored in the storage
directory. To clear stored files, simply remove the contents of the storage
directory:
rm -rf storage/*
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.