title: React & Node: Cookie has been rejected for invalid domain
body: <p>I have made a website using Node for server and Next for front-end. When I login, I make a request with these headers:</p>
  <pre><code>access-control-allow-credentials: true
  access-control-allow-origin: https://loop.herbievine.com
  server: nginx
  set-cookie: lid=s%3AF4sw6csUWeU-nytZoR5w6nrkR_4gbpd2.zt5brbuuedQiyurZOB4Hn%2FSpRa8JqtrlYhY5AHxs9Yk; Domain=https://loop.herbievine.com; Path=/; Expires=Thu, 01 Apr 2021 15:11:56 GMT; HttpOnly; Secure; SameSite=Lax
  strict-transport-security: max-age=15724800; includeSubdomains
  vary: Origin
  x-powered-by: Express
  </code></pre>
  <p>See I get a <code>set-cookie</code> header back. In the console, I see <code>Cookie “lid” has been rejected for invalid domain.</code></p>
  <p>On my server, I initialize the cookie with redis like so:</p>
  <pre class="lang-js prettyprint-override"><code>session({
      name: COOKIE_NAME,
      store: new Store({
          client: redis,
          disableTouch: true
      }),
      cookie: {
          httpOnly: true,
          secure: process.env.NODE_ENV === 'production',
          sameSite: 'lax',
          maxAge: 1000 * 60 * 60 * 24 * 7, // 1 week
          domain: process.env.CORS_ORIGIN // this being set to https://loop.herbievine.com
      },
      saveUninitialized: false,
      secret: process.env.SESSION_SECRET,
      resave: false
  })
  </code></pre>
  <p>So why is this failing? Is there an additional setting to use?</p>
  <p>Btw, I'm using Vercel + Cloudflare for all DNS settings, and server is running in a VPS + dokku on Digital Ocean</p>