We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7979c54 commit 589f3a4Copy full SHA for 589f3a4
1 file changed
main.go
@@ -57,11 +57,14 @@ func autocertListener() net.Listener {
57
return listener
58
}
59
60
+func redirect(w http.ResponseWriter, r *http.Request) {
61
+ url := fmt.Sprintf("https://%s/", r.Host)
62
+ http.Redirect(w, r, url, http.StatusMovedPermanently)
63
+}
64
+
65
func redirect80() {
- err := http.ListenAndServe(":80", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- url := fmt.Sprintf("https://%s/", r.Host)
- http.Redirect(w, r, url, http.StatusMovedPermanently)
- }))
66
+ handler := chainMiddleware(http.HandlerFunc(redirect), logRequestMiddleware)
67
+ err := http.ListenAndServe(":80", handler)
68
if err != nil {
69
fmt.Println(err)
70
0 commit comments