Skip to content

[BUG] Getting redirected to logout when trying to log in. #118

Closed

Description

@andreasmolnardev

Describe the bug
My current setup with tinyauth involves Nginx Proxy Manager.
I set it up using the guide provided in the documentation.
For nginx, it is working as expected.
But as soon as I tried putting tinyauth in front of IT Tools, it started redirecting me to the logout page.
I am using the following config for NPM:

# Root location
location / {
  # Pass the request to the app
  proxy_pass          $forward_scheme://$server:$port;

  # Add other app specific config here

  # Tinyauth auth request
  auth_request /tinyauth;
  error_page 401 = @tinyauth_login;
}

# Tinyauth auth request
location /tinyauth {
  # Pass request to tinyauth
  proxy_pass http://127.0.0.1:9002/api/auth/nginx;

  # Pass the request headers
  proxy_set_header x-forwarded-proto $scheme;
  proxy_set_header x-forwarded-host $http_host;
  proxy_set_header x-forwarded-uri $request_uri;
}

# Tinyauth login redirect
location @tinyauth_login {
  return 302 https://authproxy.andrewoid.duckdns.org/login?redirect_uri=$scheme://$http_host$request_uri; 
}

I don't think that it is related to the following error displayed in the logs since that one is also present during login to nginx...
2025-04-21T12:24:55Z WRN Session cookie is missing data

The address itself contains the correct forward uri:
https:/tinyauth.mydomain.com/login?redirect_uri=https://app2.mydomain.com/
Even the continue URL still contains the target:
https://tinyauth.mydomain.cpm/continue?redirect_uri=https://app2.mydomain.com/

To Reproduce
Steps to reproduce the behavior:
Set up any app other than nginx, put Tinyauth in front of it using Nginx Proxy Manager.
The redirection to Tinyauth happens as expected, but after clicking "continue" the next page is not the expected app, rather the Logout prompt.

Expected behavior
Instead of redirecting me to the logout URL, it should redirect to the target URL, https://app2.mydomain.com/ in my case

Activity

  1. steveiliop56 commented on Apr 21, 2025

    @steveiliop56
    Member

    Hello,

    What's your current tinyauth docker compose file? Are you using the same parent domain for tinyauth and your app? (e.g. tinyauth.example.com and app.example.com should work but tinyauth.example.com and app.example1.com won't work)

  2. andreasmolnardev commented on Apr 21, 2025

    @andreasmolnardev
    Author

    I tested both app.example.com and app.example1.com but neither was working.
    Turns out I was still on the old version, although I am using the latest image in portainer. I then re-pulled the image and got the newest version set up.
    Then I tested it with example1.com which wasn't working but example.com does work now.
    Thanks for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions