diff options
author | Greg Karékinian <greg@karekinian.com> | 2018-12-12 22:00:24 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-12-12 23:00:24 +0200 |
commit | ebef3eff2398865373901497889aee4cad3d8610 (patch) | |
tree | 6cf7fcf665999e4ecce6a8629ce85a78d845aa73 /cmd | |
parent | 0bd802e3e15f9da15a1e973052e6b9a78f11f92e (diff) | |
download | gitea-ebef3eff2398865373901497889aee4cad3d8610.tar.gz gitea-ebef3eff2398865373901497889aee4cad3d8610.zip |
Remove a double slash in the HTTPS redirection when Let's Encrypt is enabled (#5537)
Before:
$ curl 0.0.0.0:3001
<a href="https://gitea.example.com:3000//">Found</a>.
After:
$ curl 0.0.0.0:3001
<a href="https://gitea.example.com:3000/">Found</a>.
Fixes #5536
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/web.go b/cmd/web.go index b6c014a2e3..8fed559ff5 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -102,7 +102,10 @@ func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) { http.Error(w, "Use HTTPS", http.StatusBadRequest) return } - target := setting.AppURL + r.URL.RequestURI() + // Remove the trailing slash at the end of setting.AppURL, the request + // URI always contains a leading slash, which would result in a double + // slash + target := strings.TrimRight(setting.AppURL, "/") + r.URL.RequestURI() http.Redirect(w, r, target, http.StatusFound) } |