Hi ThinLinc team,
I would like to report a bug in ThinLinc 4.20.1 affecting the reverse proxy support introduced in 4.20.
Summary
When a user reconnects to an existing session through a reverse proxy, tlwebaccess generates an absolute redirect URL containing the internal listen_port (e.g. https://hostname:300/agent), bypassing the reverse proxy entirely. This does not occur when starting a new session.
Environment
- ThinLinc version: 4.20.1 (build 4529)
- Reverse proxy: Caddy
- OS: Debian/Ubuntu
- Single-server setup
Steps to Reproduce
- Configure tlwebaccess behind a reverse proxy on port 443
- Set trusted_proxies=127.0.0.1 in webaccess.hconf
- Log in via the proxy — a new session is created and the redirect works correctly (relative URL)
- Log out and log in again — an existing session is found and the browser is redirected to https://hostname:300/agent (absolute URL with internal port), bypassing the proxy
Root Cause
In modules/thinlinc/tlwebaccess/main.py there are two code paths for building redirect_target:
New session (correct — relative URL):
i1111IIi = "connect/%s/agent" % ii1ii
Reconnect to existing session (broken — absolute URL with internal port):
I1i = hive.get_integer("/webaccess/listen_port", 300)
i1111IIi = "https://%s:%s/agent" % (OO0000, I1i)
The reconnect path was not updated when reverse proxy support was introduced. It still builds an absolute URL using listen_port instead of a relative URL like the new-session path does.
Workaround
Setting login_page=https://hostname:443/ in webaccess.hconf causes ThinLinc to use the correct public URL. However, this parameter should not be required for basic reverse proxy operation, and the inconsistency between the two code paths is the underlying issue.
Expected Behavior
Both code paths should generate a relative redirect URL, e.g.:
i1111IIi = "connect/%s/agent" % OO0000
This would make reconnect behavior consistent with new session behavior and fully transparent to any reverse proxy configuration.
Thanks for the great work on 4.20 reverse proxy support — this is the last remaining piece that needs fixing.
Best regards,
Ginsterkatze