title: Why does my session cookie expire?
body: <p>In node I have a https server, and I use sessions with a maxage value, here's the code:</p>
  
  <pre><code>app.use(express.cookieParser());
  app.use(express.session({ 
    secret: 'secret stuff',
    store: sessionStore,
    cookie: { 
      secure: true,
      maxAge: 60 * 1000 //1 minute
    } 
  }));
  </code></pre>
  
  <p>I want a functionality like if the user visits the site within maxAge period (1 min in this case) the cookie timer starts over again, and he/she has 1 minute left to loose it's session id.</p>
  
  <p>I see that the <code>req.session._expires</code> is updated (by the session middleware), but the cookie is left as it is. So the cookie will expire, a new session id <code>connect.sid</code> will be generated.</p>
  
  <p>How can I achieve this? I thought it's automatically done by the session middleware, but seems like the expiration of cookie and expiration of session are two different things, than what session._expires is it for?</p>
  
  <p><strong>Edit</strong></p>
  
  <p><a href="https://github.com/senchalabs/connect/issues/328" rel="nofollow">Here</a> DanielBaulig word my problem better. As Marc B wrote in the comments the cookie expires, so the session became orphaned. That's what I want to avoid, I want to renew the cookie, when the session is touched.</p>