fix(files): honor forwarded HTTPS proxy chains (#92)
Some checks failed
CI / build (push) Has been cancelled
deploy / deploy (push) Has been cancelled
test / test (push) Has been cancelled

Co-authored-by: rissrice2105-agent <rissrice2105-agent@users.noreply.github.com>
This commit is contained in:
RissRIce 2026-07-15 07:21:31 -06:00 committed by GitHub
parent 2048229cbb
commit 24269b6799
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View file

@ -115,7 +115,11 @@ func (h *webSrv) clear(w http.ResponseWriter, r *http.Request) {
}
func secureReq(r *http.Request) bool {
return r.TLS != nil || strings.EqualFold(r.Header.Get("X-Forwarded-Proto"), "https")
if r.TLS != nil {
return true
}
proto, _, _ := strings.Cut(r.Header.Get("X-Forwarded-Proto"), ",")
return strings.EqualFold(strings.TrimSpace(proto), "https")
}
func randHex(n int) string {