Fix HTTPS scheme detection using X-Forwarded-Proto header
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user