node.js - express-session not responding to request with "Cookie-Set" header
问题描述
I have an nginx server, forwarding requests to a nodejs/express backend. The server has an ssl cert and I am connecting over https. I'm using the express-session module and the cookie configuration object looks like so,
{ secure: true, sameSite: true, httpOnly: true, domain: "example.com" }
I am also setting a proxy for the express server like so,
app.set('trust proxy', 1);
The X-Forward headers for nginx look like so,
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Host $host;
proxy_set_header X-Forward-Proto $scheme;
Any suggestions? I've tried connecting over ngrok locally before I set the domain and that seemed to work, but that configuration still did not work for nginx.
解决方案
推荐阅读
- scala - Right[Nothing, Map[String, String]] 类型的表达式不符合预期的 Left[String, Nothing] 类型
- java - Spring Cloud Stream 消息未通过消息队列接收
- javascript - 使用 react-native-router-flux 将数据从屏幕发送到选项卡屏幕
- karate - 在日志中隐藏密码
- android - 未安装客户端应用程序的推送通知
- php - 我从 API 中获取选择选项,因为应该选择一个选项
- javascript - 如何在 axios 中解决 Promise 和 spy 函数
- sql-server - 使用 SSIS 的存储过程部署和备份
- sql - SQL DB2/400:检查是否存在全局临时表
- sql - SQL 子查询首先按 not null 分组