redirect.go (281B)
1 package redirect 2 3 import ( 4 "net/http" 5 ) 6 7 type Handler struct{} 8 9 func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { 10 w.Header().Set("Connection", "close") 11 12 var url = "https://" + r.Host + r.URL.String() 13 14 http.Redirect(w, r, url, http.StatusMovedPermanently) 15 }