Add promote check (oops)

This commit is contained in:
Dj Walker-Morgan 2020-09-10 13:00:09 +01:00
parent 6ca38384a8
commit 75ec8df8c7

View file

@ -69,7 +69,7 @@ func (w *gzipResponseWriter) Write(b []byte) (int, error) {
func handleReq(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("X-Forwarded-Proto") == "http" {
if *httpsPromote && r.Header.Get("X-Forwarded-Proto") == "http" {
http.Redirect(w, r, "https://"+r.Host+r.RequestURI, http.StatusMovedPermanently)
if *logRequest {
log.Println(301, r.Method, r.URL.Path)