I'm using Connect.js and the connect-session module for managing session cookies. I noticed that Connect sets a session cookie on all routes except static files. The problem is that I process some static files like JS and CSS files before I send them so I can't use Connect's built-in static server, which means that connect-session sets a session cookie for these files. Since these files will be included on external sites, I don't want them to send cookies with them.
Is it possible to set session cookies only for specific routes?
The session cookie is a server-specific cookie that cannot be passed to any machine other than the one that generated the cookie. The session cookie allows the browser to re-identify itself to the single, unique server to which the client had previously authenticated.
Should I always allow session cookies? Session cookies are essential for a website's functionalities or for it to deliver a service that it intends to. They are also exempt from consent requirements under privacy regulations like the GDPR.
Per-session (sessional) cookies are stored in memory and are only available during an active session, in other words, while you are on the website. Per-session cookies do not permanently record data and are not stored on your computer's hard drive.
By default, SessionID values are stored in a cookie. However, you can also configure the application to store the SessionID value in the URL for a "cookieless" session.
if you are using express,you can put app.use(express.static(path.join(__dirname, 'public')));
before app.use(express.session());
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With