Skip to content

Login redirects to infinite loading — redirect: false response, no navigation after auth #4479

@Rama054

Description

@Rama054

To Reproduce

Steps to reproduce

  1. Navigate to Dokploy login page
  2. Enter valid credentials and submit
  3. POST /api/auth/sign-in/email returns 200 OK
  4. UI stays on login page, infinite loading spinner
  5. Manually reload → logged in successfully

Current vs. Expected behavior

Problem

After submitting the login form, the UI gets stuck on infinite loading. No redirect occurs. If I manually reload the page (F5), I'm already logged in — the session was created correctly.

This happens 100% of the time, on every login attempt.

Also reproducible accessing directly via ip:3000, so it's not a Cloudflare/proxy issue.

Expected behavior

After successful authentication, the frontend should navigate to /dashboard (or equivalent).

Provide environment information

### Environment

- `BETTER_AUTH_URL` is set correctly to the HTTPS domain
- `BETTER_AUTH_SECRET_FILE` uses Docker Secrets (value confirmed present and valid)
- Sessions are created correctly in the DB (`expires_at` is in the future)
- No errors in `docker service logs dokploy` related to auth or postgres at login time
- NTP synchronized: yes

**Dokploy version:** v0.29.5
**OS:** Ubuntu
**Access method:** Custom domain with HTTPS (Cloudflare DNS + Traefik + Let's Encrypt)
**Deployment type:** Single server, Docker Swarm

Which area(s) are affected? (Select all that apply)

Application

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

Network tab (DevTools)

Only one request is made after clicking login:

POST /api/auth/sign-in/email
Status: 200 OK

Response body:

{
  "redirect": false,
  "token": "...",
  "user": { ... }
}

No subsequent requests are made. The frontend receives redirect: false and does not navigate anywhere.

Additional notes

This appears related to PR #4335 ("fix: use temporary redirects for auth checks in getServerSideProps") introduced in v0.29.3, but the issue persists in v0.29.5.

The better-auth client returns redirect: false by default when called from the browser without an explicit redirectTo parameter. The frontend needs to handle this case and perform a manual router.push() after receiving a successful auth response.

Will you send a PR to fix it?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions