Set Cookie path into '/root'

Hi Team,

Session value is getting changed When I set the cookie path to root in config/session as below.

cookie: {
httpOnly: true,
sameSite: true,
path: ‘/root’
},

If I’m not setting the path and leave it like this ‘/’, I’m getting the correct session value.

Why is this happening, when I set the path, whether is it the path problem, if not how I can set path.

Please help anyone.

When you set path to root, the cookie will be available only on routes with path /root (example : http://my.app/root/*).

Useful links:

1 Like