MCPcopy
hub / github.com/caddyserver/certmagic / httpRedirectHandler

Function httpRedirectHandler

certmagic.go:157–171  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

155}
156
157func httpRedirectHandler(w http.ResponseWriter, r *http.Request) {
158 toURL := "https://"
159
160 // since we redirect to the standard HTTPS port, we
161 // do not need to include it in the redirect URL
162 requestHost := hostOnly(r.Host)
163
164 toURL += requestHost
165 toURL += r.URL.RequestURI()
166
167 // get rid of this disgusting unencrypted HTTP connection 🤢
168 w.Header().Set("Connection", "close")
169
170 http.Redirect(w, r, toURL, http.StatusMovedPermanently)
171}
172
173// TLS enables management of certificates for domainNames
174// and returns a valid tls.Config. It uses the Default

Callers

nothing calls this directly

Calls 1

hostOnlyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…