I get a 503 HTTP error today when i try to fetch a model.
This code worked 2 days ago… I think the only difference is i updated node and its dependencies.
I get a Origin MY_DOMAIN is not allowed by Access-Control-Allow-Origin. then, a 503 HTTP error on the GET request (with Chromium and Firefox).
The weird think is, i can curl the same url, the server handle it and return a response…
I made the server a simple as i could and it still doesn’t works, here is the code:
var express = require("express");
var app = express();
app.get('/user/:username/:facebook_id/:facebook_token', function(req, res){
res.header("Access-Control-Allow-Origin", "*");
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type');
console.log('Something is happening.. ');
res.send({error: 'test'});
});
app.listen(3000);
And on the client side, i just call a fetch from a model…
initialize : function() {
var that = this;
this.model.fetch({
success: function(_model){
console.log('User fetched successfully on initialize');
that.render();
},
error: function(_model, error){
console.log('User fetched unsuccessfully on initialize');
}
});
I go to the error callback after the failed the GET request.
Does anyone has an idea ? Do you think it could be a conflict with the last update of express node and backbone ?
Thanks !
UPDATE:
Apparently it doesn’t works because of my VPN, i am in China now… It could explain the not allowed errror. I’keep the subject update soon.
the problem came from my VPN which lock the URL to my own server since today, this is the reason about the “access is not allowed”…
Thanks for your help !