I have a node app with the server hosted on heroku. All my requests are successful until I have sent about 10 or 15. Then I start receiving CORS errors. Any idea why this could be occurring?
Give it a try. http://danielrasmuson.github.io/
Here is my 'CORS Enabling Code'. I'm trying a few things at this point.
var app = express();
app.use(cors());
app.all('/*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
next();
});
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
I do know not if it is not too late but maybe this can help: I had the same problem with this code: (occasionally i got cors erros with 503 heroku error)
When I changed it to :
No more failing code and cors occasionally.
Finally it seems to be problem of node app and not heroku.
Cheers Blazej