diff --git a/redirector.go b/redirector.go index 612a829..4091f1a 100644 --- a/redirector.go +++ b/redirector.go @@ -3,6 +3,7 @@ package main import ( _ "embed" "fmt" + "html" "net/http" "net/url" "strings" @@ -29,13 +30,15 @@ func main() { cm3.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { totalReqs.WithLabelValues().Inc() + refresh := "" if strings.Contains(r.Host, ".") && !strings.Contains(r.Host, ":") { var url = url.URL{Host: r.Host, Scheme: "https", Path: r.URL.Path} w.Header().Add("Location", url.String()) w.WriteHeader(301) hostReqs.WithLabelValues().Inc() + refresh = "" } - fmt.Fprintf(w, response) + fmt.Fprintf(w, response, refresh) }) cm3.ListenAndServeHttp(":80", nil) diff --git a/response.html b/response.html index 8a28d09..2aea3d1 100644 --- a/response.html +++ b/response.html @@ -3,8 +3,14 @@ Redirecting... + %s - - Just switch to https up there ↑ + +

+ This site is only available over HTTPS, please use that. +

+ diff --git a/response.min.html b/response.min.html index 081a850..049d64e 100644 --- a/response.min.html +++ b/response.min.html @@ -1 +1 @@ -Redirecting...Just switch to https up there ↑ \ No newline at end of file +Redirecting...%s

This site is only available over HTTPS, please use that.

\ No newline at end of file