Remove absolute URIs from settings page (#1261)

* Remove absolute URIs from admin page

The rest of the links on this page are absolute paths without a
specified hostname, but these in particlar use build_absolute_uri. I
am running linkding behind two different load balancers which makes
these links bubble up the "internal" hostname instead of the hostname
I actually got to the page from.

* Add LD_USE_X_FORWARDED_HOST

See: https://docs.djangoproject.com/en/6.0/ref/settings/#std-setting-USE_X_FORWARDED_HOST
This commit is contained in:
Aidan Coyle
2026-01-05 02:25:54 -06:00
committed by GitHub
parent 50180c9684
commit fdb5b4e82d
4 changed files with 27 additions and 16 deletions

View File

@@ -217,6 +217,16 @@ if LD_ENABLE_AUTH_PROXY:
if LD_AUTH_PROXY_LOGOUT_URL:
LOGOUT_REDIRECT_URL = LD_AUTH_PROXY_LOGOUT_URL
LD_USE_X_FORWARDED_HOST = os.getenv("LD_USE_X_FORWARDED_HOST", False) in (
True,
"True",
"true",
"1",
)
if LD_USE_X_FORWARDED_HOST:
USE_X_FORWARDED_HOST = LD_USE_X_FORWARDED_HOST
# CSRF trusted origins
trusted_origins = os.getenv("LD_CSRF_TRUSTED_ORIGINS", "")
if trusted_origins: