Allow Cross domain is not working in node.js

I am running backbone client on apache and server on node.js.When I run node.js it always gives:
else{ auth:false;}

and when i save from backbone it gives error on console:

 XMLHttpRequest cannot load
 http://localhost:3000/formSave. 
 Origin http://localhost is not allowed by Access-Control-Allow-Origin.


var allowCrossDomain = function(req, res, next) {
var allowedHost = [
    'http://localhost',
    'http://backbonetutorials.com'
];

if(allowedHost.indexOf(req.headers.origin) !== -1) {
    res.header('Access-Control-Allow-Credentials', "*");
    res.header('Access-Control-Allow-Origin', req.headers.origin);
    res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
    res.header('Access-Control-Allow-Headers', 'X-CSRF-Token, X-Requested-With, Accept,     Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version');
    next();
} else {
    res.send({auth: false});
}
};    
 app.configure(function(){
 app.use(allowCrossDomain);
 });

What is wrong in this code