Skip to content

fix: login redirects to the server's listening address #83

Closed

Description

@uniqueg

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.

Activity

  1. added this to the v0.1.0 milestone on Nov 14, 2026
  2. self-assigned this
    on Nov 14, 2026
  3. added
    priority: high
    status: in progress
    type: auth
    type: bug
    workload: hours
    on Nov 14, 2026
  4. moved this to In progress in ELIXIR On-Cloudon Nov 14, 2026
  5. moved this from In progress to Done in ELIXIR On-Cloudon Nov 15, 2026
  6. removed
    status: in progress
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: hightype: authtype: bugworkload: hours

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions