Next.js Discord

Discord Forum

ngrok and cookies set through middelware.ts

Unanswered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
Hi all,

I'm using ngrok (need to forward my localhost to a online env because of third party app needs to access this) and I am setting a cookie inside middleware.ts. The domain of this cookie is my ngrok domain, as it should be.

Using cookies from next/headers btw.

The problem is that I need to check if this cookie exists inside an app api route handler. e.g. /api/test/route.ts

But this cookie is never there because there the 'domain' or request url is this my localhost.

Anyone got an idea how to fix this?

0 Replies