BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

OIDC timeout - Authentik

Open kevinruffus opened this issue 9 months ago • 4 comments

Attempted Debugging

  • [x] I have read the debugging page

Searched GitHub Issues

  • [x] I have searched GitHub for the issue.

Describe the Scenario

Short version: OIDC/Authentik login fails due to timeout. This is the error displayed after the login attempt.

OIDC Discovery Error: HTTP request failed during discovery with error: cURL error 28: Resolving timed out after 5000 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://sso.mydomain.com/application/o/bookstack/.well-known/openid-configuration

If I set the urls manually, I get a different failure. Basically, Authentik runs slow as hell on my system apparently, specifically for first login attempts. Is there a way to increase the time until failure?

Initial admin login was only standard auth performed, and only to change the password.

Exact BookStack Version

v25.12.3-ls243

Log Content

No errors logged.
Checked laravel log, nginx access and error logs, and php log.
Nothing.

Hosting Environment

Docker, managed via Portainer, running on Ubuntu 24.04. pfSense running HAProxy for reverse proxying. Straight through, nothing fancy as auth is intended to be via Authentik OIDC, also running via a similar straight through HAProxy config. Cloudflare providing straight DNS, no tunnels in play. LetsEncrypt wildcard certs for domain, used in HAProxy for SSL term, and Authentik for signing tokens (not encrypting them) Custom "let's see how this works for funsies" server running many containers. Threadripper 1950x 128GB ECC RAM Docker volume storage and VM OS drive storage on ZFS mirrored 1TB Samsung NVMe drives. 10Gbps connection from server to LAN, 1Gbps fiber ISP connection

Anything else, please ask.

kevinruffus avatar Feb 11 '26 16:02 kevinruffus

Ah, I missed an earlier issue that was about this. I'll run some of the tests there and see if I can figure it out.

Update: From the barebones server running

time curl https://sso.mydomain.com/.well-known/openid-configuration

takes ~2 sec.

From inside the Bookstack container it takes over 10 seconds. Wow...

kevinruffus avatar Feb 11 '26 18:02 kevinruffus

Muahahahahahaha! Ok, so the issue was running pihole via docker macvlan on the same system as docker bookstack. It was adding several seconds to resolution in some cases.

kevinruffus avatar Feb 11 '26 21:02 kevinruffus

Glad you managed to find the issue! DNS/network gremlins like this in docker environments can be real tricky to find sometimes!

ssddanbrown avatar Feb 13 '26 14:02 ssddanbrown

It's because I use manually defined networks for each service/set of containers. It keeps the services separated and relatively isolated. I use internal only backend networks if containers from separate services need to communicate.

It drastically limits scalability and flexibility, but it's my home network serving maybe 15 users at peak so it hasn't been a problem.

Docker forces manually created/defined networks to use it's built-in DNS resolver, and outright ignores any directives to bypass it.

kevinruffus avatar Feb 14 '26 00:02 kevinruffus