Rob--W / cors-anywhere

CORS Anywhere is a NodeJS reverse proxy which adds CORS headers to the proxied request.
MIT License
8.5k stars 5.92k forks source link

Question about whitelisting #468

Closed BartRoozen closed 9 months ago

BartRoozen commented 10 months ago

Hi! I have a question about whitelisting my domain for the use of the CORS proxy I want to run.

export PORT=8080
export CORSANYWHERE_WHITELIST=https://example.com,http://example.com,http://example.com:8080
node server.js

This example is given. My first question, where would I place this code? Anywhere specific in an existing file?

Secondly, I don't know what port the client JS on my domain uses to access the proxy. Can I leave it empty?

Thanks in advance!

Rob--W commented 9 months ago

Hi! I have a question about whitelisting my domain for the use of the CORS proxy I want to run.

export PORT=8080
export CORSANYWHERE_WHITELIST=https://example.com,http://example.com,http://example.com:8080
node server.js

This example is given. My first question, where would I place this code? Anywhere specific in an existing file?

These "PORT", etc. things are called environment variables. If you don't have an obvious way to specify these (e.g. because you can only specify a path to a program to launch), then you can always wrap the invocation of the program in a shell script.

Secondly, I don't know what port the client JS on my domain uses to access the proxy. Can I leave it empty?

Leaving it empty will result in using some default port, 8080 as seen in server.js. You must know the port that the proxy is running on, otherwise the server doesn't know where to listen on, and the client doesn't know what to connect to.