Basically, I am redirecting from a.example.com to www.example.com and I expect that I can delete cookies on www.example.com (because the cookie was created with .example.com as the cookie domain), but The following code does not work.
I know that this question looks like a repeating question, I tried everything from a similar question, but it does not work. Look after the code that I have already tried .
Using expressions 3.0.3 and node 0.10.32.
session middleware
... var cookiedata = { domain : '.example.com', originalMaxAge : null, httpOnly : false }; app.use(express.session({ store : ..., secret : ..., key : 'express.sid', cookie : cookiedata })); ...
exit function
function logout(req, res){ ... req.session.destroy(function(){ req.session = null; res.clearCookie('express.sid', { path: '/' }); res.redirect('https://www.example.com'); }); }
What have I tried from a similar question
So, I put path : '/' in the express session middleware, for example:
app.use(express.session({ ..., path : '/' });
No success.
- https://groups.google.com/forum/#!topic/express-js/PmgGMNOzhgM
Instead of res.clearCookie, I used: res.cookie ('express.sid', '', {expires: new Date (1), path: '/'});
No success.
Srle
source share