Mercurial > gemma
changeset 560:66073a476baf
If header "X-Use-Protocol" is set by proxy generate https URLS in password resets.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 03 Sep 2018 18:41:19 +0200 |
parents | f827dc4f3e95 |
children | 8f075ae6cf33 |
files | pkg/controllers/pwreset.go |
diffstat | 1 files changed, 5 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/pwreset.go Mon Sep 03 18:00:38 2018 +0200 +++ b/pkg/controllers/pwreset.go Mon Sep 03 18:41:19 2018 +0200 @@ -158,14 +158,11 @@ } func useHTTPS(req *http.Request) string { - // always use HTTPS for URLs. - return "https" - /* - if strings.ToLower(req.URL.Scheme) == "https" { - return "https" - } - return "http" - */ + if req.Header.Get("X-Use-Protocol") == "https" || + req.URL.Scheme == "https" { + return "https" + } + return "http" } func generateHash() string {