mirror of https://github.com/caddyserver/caddy.git
http: Use permanent redirects for HTTP->HTTPS
This commit is contained in:
parent
dfdddcfacb
commit
16782d9988
|
@ -427,7 +427,7 @@ func (app *App) automaticHTTPS() error {
|
||||||
},
|
},
|
||||||
Handlers: []MiddlewareHandler{
|
Handlers: []MiddlewareHandler{
|
||||||
StaticResponse{
|
StaticResponse{
|
||||||
StatusCode: WeakString(strconv.Itoa(http.StatusTemporaryRedirect)), // TODO: use permanent redirect instead
|
StatusCode: WeakString(strconv.Itoa(http.StatusPermanentRedirect)),
|
||||||
Headers: http.Header{
|
Headers: http.Header{
|
||||||
"Location": []string{redirTo},
|
"Location": []string{redirTo},
|
||||||
"Connection": []string{"close"},
|
"Connection": []string{"close"},
|
||||||
|
@ -447,8 +447,8 @@ func (app *App) automaticHTTPS() error {
|
||||||
var redirRoutes []Route
|
var redirRoutes []Route
|
||||||
|
|
||||||
// for each redirect listener, see if there's already a
|
// for each redirect listener, see if there's already a
|
||||||
// server configured to listen on that exact address; if
|
// server configured to listen on that exact address; if so,
|
||||||
// so, simply the redirect route to the end of its route
|
// simply add the redirect route to the end of its route
|
||||||
// list; otherwise, we'll create a new server for all the
|
// list; otherwise, we'll create a new server for all the
|
||||||
// listener addresses that are unused and serve the
|
// listener addresses that are unused and serve the
|
||||||
// remaining redirects from it
|
// remaining redirects from it
|
||||||
|
|
Loading…
Reference in New Issue