如何在请求之间的express中保存sessionID?
我有一个应用程序,可以从客户端向服务器提出3个请求。
我需要使用我从ws
获得的数据。
因此,我想将一些数据存储在服务器中,而不要将其返回到客户端。
如何设置我的sessionID
在Express Server执行客户端请求中确实关联?
现在,我的sessionId
重新启动了我对服务器的每个请求...
我使用reverseproxy
使用pm2
运行我的Express Server。
我的客户端和服务器在https
上运行,
我的会话配置看起来像这样:
app.set("trust proxy", 1)
app.use(session({
proxy:true,
resave:true,
secret: process.env.SECRET,
cookie: {secure : true, maxAge : 8 * 60 * 60 *1000,sameSite: "none", httpOnly:false},
credentials:true,
saveUninitialized:true,
})
)
I'm have an app which i make 3 requests from the client to the server.
Each call i need to use data that i get from the WS
.
So i want to store some data in the server and don't return it to the client.
How can set my sessionID
do be associated in the express server do the client request?
Now my sessionID
restart every request that i make to the server...
I use reverseProxy
to run my express server using pm2
.
My client and my server run on HTTPS
My session config look like this :
app.set("trust proxy", 1)
app.use(session({
proxy:true,
resave:true,
secret: process.env.SECRET,
cookie: {secure : true, maxAge : 8 * 60 * 60 *1000,sameSite: "none", httpOnly:false},
credentials:true,
saveUninitialized:true,
})
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论