title: Express-session Secure Cookies not working
body: <p>When not using secure cookie true setting, my app user login works fine. When I enable secure cookies, the login appears to go through fine, but it seems the cookie is not saved and the user is not logged in.</p>
  
  <p>In other words, this works:</p>
  
  <pre><code>app = express();
  app.use(session({
      secret: 'secret code',
      store: sessionStore,
      resave: false,
      saveUninitialized: false,
      cookie: {
          secure: false,
          maxAge: 5184000000 // 60 days
          }
  }));
  </code></pre>
  
  <p>This does not work (user isn't able to log in):</p>
  
  <pre><code>app = express();
  app.set('trust proxy');
  app.use(session({
      secret: config.cookieSecret,
      store: sessionStore,
      resave: false,
      saveUninitialized: false,
      proxy: true,
      secureProxy: true,
      cookie: {
          secure: true,
          httpOnly: true,
          maxAge: 5184000000 // 60 days
          }
  }));
  </code></pre>
  
  <p>Behind cloudflare and nginx. This is in my nginx config: </p>
  
  <pre><code>location ~ / {
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass http://localhost:3000;
  }
  </code></pre>
  
  <p>From what I read, I think it should work. What am I missing?</p>
  
  <p>EDIT: I am running https with a valid ssl cert.</p>