0

I have to set a session id from my ExpressJS middleware with a "Set-Cookie" header, that I get from another source. It seems like ExpressJS blocks it. Here is my code snippet:

res.cookie("sessionid", "value-from-backend", {
    domain: ".domain.com",
    httpOnly: true
})

Another Set-Cookie header that I tried, works without a problem:

res.cookie("test", "lel", {
    domain: ".domain.com",
    httpOnly: true
})

Do I have to use ExpressJS cookie session to get this work or is there a simpler way? And how can I achieve this with ExpressJS cookie session?

My ExpressJS version is: `4.16.3.

It is no duplicate of other Set-Cookie problems, because it is just not working with sessionid but with any other cookie name.

alexfi
  • 370
  • 2
  • 11
  • Possible duplicate of [How to set cookie in node js using express framework?](https://stackoverflow.com/questions/16209145/how-to-set-cookie-in-node-js-using-express-framework) – lux Mar 25 '19 at 14:27
  • @lux No it's not because it works with other cookie names. Check my edit. – alexfi Mar 25 '19 at 14:31

0 Answers0