My app is running on 3000 and I have set proxy to points 3000 from a subdomain name but the session is not working on proxy.
I have tried this:
app.enable('trust proxy');
But it doesnt work.
Nginx config
listen 80;
server_name sub.domain.com;
location / {
proxy_pass http://domain.com:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
Session config
app.use(session({
store: sessionStore, //tell express to store session info in the Redis store
secret: 'mysecret',
key: 'emre',
saveUninitialized: false,
proxy: true,
resave: true,
maxAge: 60000