As the title said, i use express-session and redis deal with session. code like this:
app.use(session({
store: new RedisStore({
"host": "115.28.87.181",
"port": "6379",
"ttl": 60 * 60 * 20,
"pass": "",
"db": 0,
"prefix": "session"
}),
name: "sessionid",
secret: '',
resave: true,
saveUninitialized: true,
cookie: {
path: '/',
httpOnly: false,
secure: false,
maxAge: 60 * 60 * 20
},
rolling: true,
unset: "destroy"
}));
It can store session and works well.
When i request a link like http://127.0.0.1/sign/availd_id?id=tosone
make sure which id is available. Problems are coming in Chrome except firefox and safari.
My NodeJs server will response to chrome {code: 200
, and wait for a long long time, the browser state is request is not finished yet
, and JS is not run.
After a long long time about 2 minutes, Chrome will get the full information {code:200}
. it looks like the browser wait for the }
.
But the Server Log said it had responsed the whole information to browser long before. the log is this:GET /sign/availd_id?id=tosone 200 73.555 ms
, it comes when i refresh the browser.
there is nothing with http keep-alive in my code.
Remove the code above or with firefox, problems will never been like that.
遇到同样的问题,但是没有发现必然规律。唯一可以确认的是:火狐一直好好的,就chrome有问题,而且会偶尔没有问题。