79475852

Date: 2025-02-28 14:32:48
Score: 1.5
Natty:
Report link

I have experienced same problem. It can be tested by external simple test.html file with form

<form name="someForm" action="http://localhost:3000/some-url" method="POST"></form>

In requested url in req.headers sometimes present req.cookie, and sometimes not. When not - of course session was deleted. I could not find reason of this. My solution was simple. Make middleware before app.use(session({})

app.use((req,res) => {
    if (req.path === '/some-url') {
        //logic
    }
})
app.use(session({})

But i would like to know really reason of this, not a work around.

Reasons:
  • Blacklisted phrase (1.5): i would like to know
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Dmo