I'm encountering an odd error with AngularJS / Google Chrome. When I do an $http.get() it takes up to 18 seconds before it actually completes. It seems to keep at "PENDING" for the "OPTIONS" method:
http://i.imgur.com/yEozFdm.png
The server that serves the pages is Mongoose, the one @ localhost:5000 is Flask, who returns the following headers in order for the CORS to work.
@mod.after_request
def after_request(response):
response.headers.add('Access-Control-Allow-Origin', 'http://localhost:8080')
response.headers.add('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
response.headers.add('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
Anyone knows why Chrome is delaying the OPTIONS request? (From the flask server debug console, it seems that the OPTIONS method really only arrives 10-20 seconds after the page has been reloaded). It seems to work fine in Firefox.
It seems to have been solved once I disabled the "Predict network actions to improve page load performance" option. Very odd, perhaps I should leave this question open for if someone could give a possible reason for this?
Edit: See comments for the reason!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With