Session cookies for specific routes only

I am using Connect.js and the connect-session module to manage 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, such as JS and CSS files, before sending them, so I cannot use the built-in static Connect server, which means that the connection session sets a session cookie for these files. Since these cookies will be included on external sites, I do not want them to send cookies with them.

Is it possible to set session cookies only for certain routes?

+5
source share
2 answers

Ok, I found my answer here: http://senchalabs.github.com/connect/middleware-session.html

You can ignore routes using connect.session.ignore as follows: connect.session.ignore.push('/robots.txt');

+2
source

if you use express, you can put app.use(express.static(path.join(__dirname, 'public')));up app.use(express.session());.

+2
source

All Articles