Skip to content

Commit

Permalink
Backport go-gitea#5537 Remove a double slash in the HTTPS redirect wi…
Browse files Browse the repository at this point in the history
…th Let's Encrypt (go-gitea#5539)

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 go-gitea#5536
  • Loading branch information
gregkare authored and techknowlogick committed Dec 13, 2018
1 parent 800271e commit 200b974
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 200b974

Please sign in to comment.