From ed854ec905a58650a60b5bdddd857986ec08784a Mon Sep 17 00:00:00 2001 From: Ahmed AbdelHalim Date: Sat, 13 Sep 2025 16:54:59 +0200 Subject: Fix handling IsHTTPS warning behind reverse proxies --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index e9137a2..1ef9a0b 100644 --- a/main.go +++ b/main.go @@ -223,7 +223,10 @@ func (s *Server) handleLogin(w http.ResponseWriter, r *http.Request) { func (s *Server) showLoginForm(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") - isHTTPS := r.TLS != nil + isHTTPS := r.TLS != nil || + r.Header.Get("X-Forwarded-Proto") == "https" || + r.Header.Get("X-Forwarded-Ssl") == "on" || + r.Header.Get("X-Url-Scheme") == "https" templateData := map[string]any{ "Error": "", "IsHTTPS": isHTTPS, -- cgit v1.2.3