Repository navigation
Description
What happens?
In the Docker image, a successful login sends the browser to http://0.0.0.0:3000/dashboard (the port is the PORT the image listens on), not to the app's origin. The session cookies are set for the real origin, so the user arrives logged out at an address that doesn't work. The error redirects of the callback (/auth/error?type=...) go to the same wrong origin.
Why?
src/app/auth/api/callback/route.ts builds every redirect with new URL(path, request.url). Next.js's standalone server, which the image runs (bun server.js, listening on HOSTNAME=0.0.0.0), sees its listening address as the origin of request.url, not the Host the browser used. next start, which the end-to-end tests ran so far, uses localhost, so the tests passed. Running the end-to-end journey against the image (#79) showed it: 5 of 11 Chromium tests failed, all at the redirect after the login.
The current deployment at krini.rahtiapp.fi doesn't serve this image yet (it returns a static nginx page), so no users are affected now. Every deployment of the image is.
How?
Redirect to APP_ORIGIN, which every deployment sets already, as the logout route and the service-info page use it. Fall back to the origin of the request only when it isn't set or isn't a URL, and log that case. Add unit tests with a request at http://0.0.0.0:3000, and document in the configuration reference that the login sends users back to APP_ORIGIN.
Acceptance criteria
- After a login, and on callback errors, the browser goes to
APP_ORIGIN, also when the server sees another origin. - The end-to-end journey passes against the image.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity