mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-25 04:33:03 +00:00
fix: detect HTTPS protocol when behind reverse proxy for setup scripts
addresses #394 - setup script now correctly uses https:// in generated commands when Pulse is running behind an HTTPS reverse proxy like Traefik by checking the X-Forwarded-Proto header
This commit is contained in:
@@ -2714,10 +2714,12 @@ func (h *ConfigHandlers) HandleSetupScriptURL(w http.ResponseWriter, r *http.Req
|
||||
// For production, keep the original host (users will need proper proxy config)
|
||||
}
|
||||
|
||||
pulseURL := fmt.Sprintf("%s://%s", "http", host)
|
||||
if r.TLS != nil {
|
||||
pulseURL = fmt.Sprintf("%s://%s", "https", host)
|
||||
// Detect protocol - check both TLS and proxy headers
|
||||
scheme := "http"
|
||||
if r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https" {
|
||||
scheme = "https"
|
||||
}
|
||||
pulseURL := fmt.Sprintf("%s://%s", scheme, host)
|
||||
|
||||
encodedHost := ""
|
||||
if req.Host != "" {
|
||||
|
||||
Reference in New Issue
Block a user