Unverified Commit 5cd8e878 authored by Rishabh Poddar's avatar Rishabh Poddar Committed by GitHub

Update to with-supertokens example app (#56035)

Adds cache control headers in the auth middleware to prevent issues with cached tokens being passed in GET API requests.
Co-authored-by: 's avatarMihály Lengyel <1129990+porcellus@users.noreply.github.com>
Co-authored-by: 's avatarNemi Shah <18233774+nkshah2@users.noreply.github.com>
Co-authored-by: 's avatarLee Robinson <9113740+leerob@users.noreply.github.com>
parent 10c5c446
...@@ -9,6 +9,11 @@ supertokens.init(backendConfig()) ...@@ -9,6 +9,11 @@ supertokens.init(backendConfig())
export default async function superTokens(req, res) { export default async function superTokens(req, res) {
await superTokensNextWrapper( await superTokensNextWrapper(
async (next) => { async (next) => {
// This is needed for production deployments with Vercel
res.setHeader(
'Cache-Control',
'no-cache, no-store, max-age=0, must-revalidate'
)
await middleware()(req, res, next) await middleware()(req, res, next)
}, },
req, req,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment