Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Hi :)
I am trying to debug my express server. I have a reverse proxy set up with NGINX and Let’s Encrypt. I am able to successfully connect using HTTPS. I get the green lock and it says ‘Connection secure’.
I am using session-based auth with express-sessions. My cookies work perfectly when the secure flag is not set. The moment I set secure to true my cookies gets rejected. Not sure why this is, I have trust-proxy set up and my connection is secure. Any ideas?
Here is a sample of the logs I am getting: “Some cookies are misusing the recommended “SameSite“ attribute” “Cookie “sid” has been rejected because it is already expired.”
And here is my cookie setup:
if (process.env.NODE_ENV === "production") {
app.set('trust proxy', 1)
}
app.use(
session({
name: "sid",
resave: false,
saveUninitialized: false,
secret: process.env.SESSION_SECRET,
cookie: {
domain: process.env.BASE_URL,
path: "/",
sameSite: "strict",
secure: process.env.NODE_ENV === "production" ? true : false,
maxAge: 1000 * 60 * 60 * 2, // 2 hours
},
store: MongoStore.create({
client: db.getClient(),
ttl: 60 * 60 * 2, // 2 hours, in seconds
touchAfter: 24 * 3600, // time period in seconds
crypto: {
secret: process.env.STORE_SECRET,
},
}),
})
);
Like I mentioned, no logs or errors once I take out secure (i.e. if I don’t see my NODE_ENV to “production”)
Thank you in advance.
Edward Sitarski
1fd6b9d2a2b94ee4b3e8ee6d5e2587
Traceurity
fadecomic
Mollie Semmes
Will Walters
f4df2e98b9c74f7eb7f6a0629cf1c4
erel
fingers
fingers