mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-19 09:32:46 +08:00
http: Don't use a Host matcher for HTTP->HTTPS redirects
In case on-demand TLS is enabled, in that case we don't know the only names that have automatic HTTPS. See https://caddy.community/t/v2-http-to-https-redirects-fail-for-on-demand-ssl-certs/6742?u=matt
This commit is contained in:
parent
590480513a
commit
994b9033e9
|
@ -486,12 +486,7 @@ func (app *App) automaticHTTPS() error {
|
||||||
// create the route that does the redirect and associate
|
// create the route that does the redirect and associate
|
||||||
// it with the listener address it will be served from
|
// it with the listener address it will be served from
|
||||||
lnAddrRedirRoutes[httpRedirLnAddr] = Route{
|
lnAddrRedirRoutes[httpRedirLnAddr] = Route{
|
||||||
MatcherSets: []MatcherSet{
|
MatcherSets: []MatcherSet{{MatchProtocol("http")}},
|
||||||
{
|
|
||||||
MatchProtocol("http"),
|
|
||||||
MatchHost(domains),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Handlers: []MiddlewareHandler{
|
Handlers: []MiddlewareHandler{
|
||||||
StaticResponse{
|
StaticResponse{
|
||||||
StatusCode: WeakString(strconv.Itoa(http.StatusPermanentRedirect)),
|
StatusCode: WeakString(strconv.Itoa(http.StatusPermanentRedirect)),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user