Skip to content

Commit

Permalink
docs(examples): add secure flag explanation to with-iron-session (#31896
Browse files Browse the repository at this point in the history
)

Following comment on the project here: vvo/iron-session#425
  • Loading branch information
vvo authored Nov 29, 2021
1 parent b1be180 commit 127b92b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/with-iron-session/lib/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import type { User } from 'pages/api/user'
export const sessionOptions: IronSessionOptions = {
password: process.env.SECRET_COOKIE_PASSWORD as string,
cookieName: 'iron-session/examples/next.js',
// secure: true should be used in production (HTTPS) but can't be used in development (HTTP)
cookieOptions: {
secure: process.env.NODE_ENV === 'production',
},
}

// This is where we specify the typings of req.session.*
Expand Down

0 comments on commit 127b92b

Please sign in to comment.