Express-session Secure Cookies not working

后端 未结 7 703
伪装坚强ぢ
伪装坚强ぢ 2021-01-18 00:16

When not using secure cookie true setting, my app user login works fine. When I enable secure cookies, the login appears to go through fine, but it seems the cookie is not s

7条回答
  •  情话喂你
    2021-01-18 00:54

    That's exactly what secure cookie does. It does not get saved by the browser in an insecure environment, read http://.

    You need to add an ssl sert, redirect all http requests to https and then the cookie would get saved in the browser.

    Getting https set up on local is irritating, so set secure in a config / environment variable you also set to false on your source control and enable it for prod/ staging.

    Edit: Also enable resave, resave: true

提交回复
热议问题