Next.js Discord

Discord Forum

Redirect loop

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Hello, recently we refactored our app and switched to Next JS. Currently we are testing it on our client's test env and we encountered a redirect loop.
We are using middleware and a base path change but even without these two, the redirect loop happens.
Previously we were using Nginx (for context path since client requested app to be under <domain>/app) and serving it as static files (Vite) and we had no issue.
We still need to keep <domain>/app as a homepage for our app.
Worth noting, client has it's own proxy that redirects user to SSO and back to our app.
Any idea what may be happening, any guidance?
Thank you.

EDIT: Forgot to mention that we are not using Nginx anymore.

2 Replies

Sun bear
could you post the code of your middleware?
Bigeye tuna
We've just tried fresh setup without any middleware or basePath added, same result. Because client forces us to use this /app path we've also tried to add it to basePath and also just as folder inside app router with no luck. On standalone build we're getting info that no path is matched for some reason on /app, but at the same time when it's started on local it is working just fine (it's in docker).

Static export with nginx as server is also working just fine, but we'd prefer to keep having server to host /api routes