Reputation: 3503
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?
Upvotes: 5
Views: 2313
Reputation: 56
if you are using express,you can put app.use(express.static(path.join(__dirname, 'public')));
before app.use(express.session());
.
Upvotes: 3
Reputation: 3503
Alright I found my answer here: http://senchalabs.github.com/connect/middleware-session.html
You can ignore routes by using connect.session.ignore like so: connect.session.ignore.push('/robots.txt');
Upvotes: 2