The problem is this: in a deployed nodejitsu application, often (not always!), When I redirect from the browser (clicks aa href = "/ logout") to the / logout route, I get a request. undefined session inside this route.
app.get('/logout', function(req, res){
log.debug("session", req.session);
});
Requests go through the following stack of "middleware":
var store = new db.store({client: db.client});
app.configure(function(){
[...]
app.use(express.cookieParser("XXXpassXXX"));
app.use(express.bodyParser());
app.use(express.session({
secret: "XXXpassXXX",
store: store
}));
app.use(function(req, res, next) {
var fullURL = req.protocol + "://" + req.get('host') + req.url;
if (fullURL.indexOf("logout") != -1 || fullURL[fullURL.length-1] == "/") {
log.debug(fullURL);
log.debug("sesiune", JSON.stringify(req.session));
log.debug("cookies", JSON.stringify(req.cookies));
}
next();
});
app.use(passport.session());
app.use(app.router);
});
I checked the browser and sent the cookies to the server and to my "logger" middleware, I see that fullURL is installed correctly.
Also, the last request made by the redis application for the application before the failure is to get "sess: xxx" in the correct session identifier (which is stored correctly in the database).
, express.session() connect-redis, () , req.session undefined, , redis "get" ?
PS: redis .