Skip to content

[BUG] Multi-server tinyauth redirect error #134

@eliasbenb

Description

@eliasbenb

Describe the bug

When using tinyauth on a second level subdomain and signing in, the page doesn't redirect correctly. Instead, it takes you to the main tinyauth landing page.

Despite that, authentication still works as expected with cookies being set correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Have tinyauth running on a 1st level subdomain (e.g. tinyauth.example.com)
  2. Setup a secondary app on a 2nd level subdomain behind tinyauth (e.g. some.app.example.com)
  3. Go to the secondary app's URL
  4. Get redirected to the tinyauth log in page
  5. After a successful log in, notice that you are not redirected to the secondary app

Expected behavior

After a login, the user should be redirected to the URL they were first trying to reach.

Logs
Please include the Tinyauth logs below, make sure to not include sensitive info.

2025-05-03T00:07:08Z INF Starting tinyauth version=v3.3.0
2025-05-03T00:07:08Z INF Parsing users
2025-05-03T00:07:08Z DBG Using users from file
2025-05-03T00:07:08Z DBG Parsing users
2025-05-03T00:07:08Z DBG Parsed users
2025-05-03T00:07:08Z DBG Getting domain
2025-05-03T00:07:08Z INF Using domain for cookie store domain=example.com
2025-05-03T00:07:08Z DBG Setting up router
2025-05-03T00:07:08Z DBG Setting up assets
2025-05-03T00:07:08Z DBG Setting up file server
2025-05-03T00:07:08Z INF Starting server address=0.0.0.0 port=3000
2025-05-03T00:07:18Z INF Request address=[::1]:60992 latency="25.7µs" method=GET path=/api/healthcheck status=200
2025-05-03T00:07:28Z INF Request address=[::1]:50816 latency="33.629µs" method=GET path=/api/healthcheck status=200
2025-05-03T00:07:38Z INF Request address=[::1]:39058 latency="25.704µs" method=GET path=/api/healthcheck status=200
2025-05-03T00:07:38Z DBG Getting app context
2025-05-03T00:07:38Z INF Request address=172.22.0.10:48484 latency="402.644µs" method=GET path=/api/app status=200
2025-05-03T00:07:38Z DBG Getting user context
2025-05-03T00:07:38Z DBG Getting session cookie
2025-05-03T00:07:38Z DBG Got session
2025-05-03T00:07:38Z WRN Session cookie is invalid
2025-05-03T00:07:38Z DBG Deleting session cookie
2025-05-03T00:07:38Z DBG Provider is not username
2025-05-03T00:07:38Z DBG Unauthorized
2025-05-03T00:07:38Z INF Request address=172.22.0.10:48500 latency="989.932µs" method=GET path=/api/user status=200
2025-05-03T00:07:43Z DBG Request is most likely coming from a browser
2025-05-03T00:07:43Z DBG Got proxy proxy=traefik
2025-05-03T00:07:43Z DBG Docker not connected, returning empty labels
2025-05-03T00:07:43Z DBG Got labels labels={"Allowed":"","Headers":null,"OAuthGroups":"","OAuthWhitelist":"","Users":""}

Device (please complete the following information):

  • OS: Windows 11
  • Browser FireFox
  • Tinyauth v3.3.0
  • Docker 28.1.1

Additional context

The cause of the problem seems to be in the redirect_uri. After being redirected to the tinyauth login page, the redirect URI is filled correctly with https://some.app.example.com but then another redirect occurs, which almost instantly overwrites the redirect_uri to tinyauth.example.com.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions