fix: redirectHTTP middleware redirect loop when behind another proxy

This commit is contained in:
yusing 2025-04-24 09:27:10 +08:00
parent 08ee82d7b0
commit 806184e98b

View file

@ -19,7 +19,7 @@ var RedirectHTTP = NewMiddleware[redirectHTTP]()
// before implements RequestModifier.
func (m *redirectHTTP) before(w http.ResponseWriter, r *http.Request) (proceed bool) {
if r.TLS != nil {
if r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https" {
return true
}