I’ve been struggling recently with a super-weird problem only happening in Chrome: as my API (NodeJS) is on a different subdomain, I need to use CORS to reach it from my front-end (EmberJS).
It’s working pretty well but I’m very frequently (95% of the time) having very very slow OPTIONS queries, delaying any API calls by about 3 seconds.
Most of this time is spent downloading an empty content:
It gets even weirder when I’m trying this on another website we made using a similar architecture, experiencing the exact same problem.
A few other things I tried:
- I’ve been trying this with Firefox and Safari, and didn’t get any delay.
- I’ve been trying this locally or in production, experimenting the same delay.
- I’ve been trying this with incognito mode (no extensions), and I have the exact same problem.
We’re using on the back-end NodeJS with the CORS package.
Now, I have no idea if the problem is on either Chrome 60, NodeJS, the CORS package or EmberJS + jQuery.
Anyone experienced this too?
Just as a note: It seems a chrome bug
I reproduced the issue using a server with two DNS names using a service in a unique domain
https://domain1.com --> https://domain1.com (No CORS, no delay) https://domain2.com --> https://domain1.com (CORS, delay)
It is exactly the same service responding to two names, so I am testing exactly the same request, client and server code (DNS names are interchangeable)
- Chrome 61.0.3163.100 (Windows) –>DELAY
- Chrome 62.0.3202.84 (Android) –>DELAY
- Chrome 62.0.3202.84 (iOS-Ipad) –>OK!!!
- Edge –> OK
Workaround (in my case). Create a proxy in my host to respond to the same origin DNS and avoid CORS