-
Notifications
You must be signed in to change notification settings - Fork 9
Description
I am running OpenUEM behind a reverse proxy (caddy, configuration as defined in this repository) and trying to integrate OIDC authentication with Authentik.
Problem
Login via Authentik fails because OpenUEM generates an invalid redirect_uri:
https://https://openuem.example.com/oidc/callback
I have tried messing with header manipulation
Environment
OpenUEM deployed via docker-compose
Reverse proxy: nginx in front (SSL termination)
internal proxy: Caddy (used for TLS/mTLS on auth port)
Auth provider: Authentik
Console runs on port 1323
Auth runs on port 1324
What I have verified
No https:// is set in any OpenUEM environment variables
SERVER_NAME, REVERSE_PROXY_SERVER, DOMAIN env vars are hostname-only
Redirect URI in Authentik is correct and matches expected callback
Direct access to console port (without proxy) also does trigger malformed redirects
Proxy header debugging
I used a header-echo container (mendhak/http-https-echo) directly upstream of OpenUEM to capture the exact headers OpenUEM receives.
Relevant headers observed:
{
"host": "uem.example.com",
"x-forwarded-host": "uem.example.com",
"x-forwarded-proto": "https",
"x-forwarded-port": "443",
"x-original-url": "https://uem.example.com/",
"x-forwarded-scheme": "https",
"x-forwarded-uri": "/",
"x-forwarded-method": "GET"
}This suggests OpenUEM may be using headers like X-Original-URL or X-Forwarded-Uri (which already contain a scheme), and then prepends https:// again, resulting in double schemes.
Mitigations attempted
I tried all of the following (individually and in combination):
- Force clean headers. Explicitly set:
- Host
- X-Forwarded-Host
- X-Forwarded-Proto
- X-Forwarded-Port
- Strip conflicting headers. Removed:
- X-Original-URL
- X-Forwarded-Uri
- X-Forwarded-Scheme
- Forwarded
- X-Forwarded-Method
- X-Original-Method
Result:
Either double https reappears or host becomes empty (redirect_uri=https:///oidc/callback)
- Single-proxy setups. Tested:
Browser → nginx → OpenUEM
Browser → nginx → Caddy → OpenUEM
Browser → Caddy → OpenUEM
All show the same issue when proxied.
Conclusion / suspected root cause
OpenUEM appears to:
Derive its external base URL dynamically from request headers
Prefer headers like X-Original-URL or X-Forwarded-Uri
Does not robustly normalize or validate scheme/host combinations
Has no explicit configuration option to define a canonical external URL
This makes OpenUEM extremely fragile behind common reverse proxies, especially nginx-based ones that inject X-Original-* headers.
I’m happy to test patches or provide more header dumps if needed.
Cheers and hats off to you and this product!
Joel