Fix HTTPS scheme detection using X-Forwarded-Proto header

This commit is contained in:
Leon Bösche
2026-01-10 15:58:14 +01:00
parent f372172898
commit 0f13b6c01d

View File

@@ -367,7 +367,9 @@ func viewerHandler(w http.ResponseWriter, r *http.Request, db *database.DB, audi
// Build download URL with proper URL encoding using the request's scheme and host
scheme := "https"
if r.TLS == nil {
if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" {
scheme = proto
} else if r.TLS == nil {
scheme = "http"
}
host := r.Host
@@ -431,7 +433,9 @@ func userViewerHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
// Build download URL with proper URL encoding using the request's scheme and host
scheme := "https"
if r.TLS == nil {
if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" {
scheme = proto
} else if r.TLS == nil {
scheme = "http"
}
host := r.Host