cors-anywhere icon indicating copy to clipboard operation
cors-anywhere copied to clipboard

configure for https

Open kaiyangli777 opened this issue 4 years ago • 2 comments

Hi there,

I am currently try to host cors-anywhere on my own server. I've done test with http://localhost:3030/url-of-the-actual-api, and it worked fine. I am now trying to use https://localhost:3030/url-of-the-actual-api, I've followed the instructions provided in issue#74, added the code below: cors_anywhere = createServer({ httpsOptions: { key: fs.readFileSync(path-to-the-key), cert: fs.readFileSync(path-to-the-cert), }, });

And I've also configured my apache config file and added a subdomain for port 3030, (xxx.mydomain.com) and it brings me to the page that shows "This API enables cross-origin requests to anywhere..." . However, when I make the cors API call with the subdomain with https (https://xxx.mydomain.com/url-of-the-actual-api), it responded with code 200 and the content of the "This API enables cross-origin requests to anywhere..." page, instead of the response content of the actual API call...

I'm doing something wrong? Could you give me some advice? Thank you in advance...

kaiyangli777 avatar Apr 05 '21 15:04 kaiyangli777

This is not an issue with https (the fact that you see any response means that https has been configured as expected). This error is because of your Apache configuration.

Which version of CORS Anywhere are you using? Are you using the latest version of the master branch or the one from npm?

This is likely not an issue with CORS Anywhere, but a frequently occurring error that I introduced a new error message in https://github.com/Rob--W/cors-anywhere/commit/34ec83b25ccacad5c523e6b0ad2e156d2107c6e6

See https://github.com/Rob--W/cors-anywhere/issues/238#issuecomment-629638853

Rob--W avatar Apr 05 '21 16:04 Rob--W

Aha! Great catch! I will take a look, thank you.

kaiyangli777 avatar Apr 05 '21 17:04 kaiyangli777