Next.js Discord

Discord Forum

middleware request url on standalone build for docker

Unanswered
English Spot posted this in #help-forum
Open in Discord
Avatar
English SpotOP
When having a middleware that uses NextResponse.redirect req.url is 0.0.0.0

eg: return NextResponse.redirect(new URL('/', request.url));

what is the magic that makes this work on vercel?

how should i mitigate against this?


my use case is:
in middleware.ts i use an auth check given the presence of a cookie redirects to an api route (to refresh token) or to login to provide credentials.

Thanks,
Cezar

0 Replies