https://stackoverflow.com/questions/53819310/cookie-not-set-with-express-session-in-production

 

Cookie not set with express-session in production

My app is divided between Client and Server. Client is a frontend side Nextjs app hosted on Now.sh, Server is its backend created with Express and hosted on Heroku, so the domains are client-app.no...

stackoverflow.com

해당 스택오버플로우 글에서 해결법을 찾을 수 있었다.

app.js에서 session을 설정해주는 부분에서 cookie{ }에 도메인을 설정해주면된다. 

cookie{

    domain: 'example.com', path: '/'

}

그리고 proxy도 신뢰해주자.

app.set('trust proxy',1)

 

복사했습니다!