@marcel91200 / caddy Mirror · read-only / commits / 994b9033
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

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

Matthew Holt committed Jan 9, 2020 at 14:39 UTC 994b9033e96da270dca48ab01377431028c06b52
1 file changed +1 -6
modules/caddyhttp/caddyhttp.go
+1 -6
@@ -486,12 +486,7 @@ func (app *App) automaticHTTPS() error {
486 // create the route that does the redirect and associate
487 // it with the listener address it will be served from
488 lnAddrRedirRoutes[httpRedirLnAddr] = Route{
489 - MatcherSets: []MatcherSet{
490 - {
491 - MatchProtocol("http"),
492 - MatchHost(domains),
493 - },
494 - },
489 + MatcherSets: []MatcherSet{{MatchProtocol("http")}},
490 Handlers: []MiddlewareHandler{
491 StaticResponse{
492 StatusCode: WeakString(strconv.Itoa(http.StatusPermanentRedirect)),