首页 > 解决方案 > 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.

标签: node.jsexpressnginxsession-cookiesexpress-session

解决方案


推荐阅读