Rob--W / cors-anywhere

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

Using this proxy there is still CORS issue when my app loads for the first time #209

Open SujitGodavarti opened 4 years ago

SujitGodavarti commented 4 years ago

Hi, I am prefixing the CORS anywhere url to my API url as mentioned but I am still getting a CORS issue first time when my app loads. If I refresh the app, then it works fine. I have attached a screenshot of the error I encounter first time on app load.

CORS_Error

Mine is an Angular 8 application and I don't understand why this issue happens for the first time. Please help me out with this.

Rob--W commented 4 years ago

There is not enough information in this bug report to tell whether the issue is due to your other API endpoint or CORS Anywhere.

If you consistently experience the failure when you run your application for the first time, then it is likely an error from the destination URL.

If the error does not happen very often, but only sometimes, then it may be an intermittent error caused by an overloaded server.

SujitGodavarti commented 4 years ago

I don't experience this failure consistently and it mostly happens when I start the app after a gap of few hours. The first request in my app is a POST request. I thought may be this is causing the issue and as a workaround I added a dummy GET call with the url 'https://corsanywhere.herokuapp.com/https://dummygetrequest' which doesn't exist and returns a 404. After adding this dummy request prior to my first POST request, this issue is not happening. I couldn't figure out the reason. Is CORS Anywhere okay if the first request is a POST? Is it something to do with headers which get set after a failed GET request?

Rob--W commented 4 years ago

CORS Anywhere does not treat POST any differently from GET.

zxh19890103 commented 4 years ago

https://corsanywhere.herokuapp.com