diff --git a/server/certificates/cached_challengers.go b/server/certificates/cached_challengers.go index 6bd8ff7..2a30c26 100644 --- a/server/certificates/cached_challengers.go +++ b/server/certificates/cached_challengers.go @@ -66,18 +66,18 @@ func SetupHTTPACMEChallengeServer(challengeCache cache.SetGetKey, sslPort uint) } log.Info().Msgf("HTTP-ACME challenge for '%s' succeeded", domain) ctx.String(challenge.(string)) - - } else { - // it's a normal http request that needs to be redirected - u, err := url.Parse(fmt.Sprintf("https://%s%s%s", domain, portPart, ctx.Path())) - if err != nil { - log.Error().Err(err).Msg("could not craft http to https redirect") - ctx.String("", http.StatusInternalServerError) - } - - newURL := u.String() - log.Debug().Msgf("redirect http to https: %s", newURL) - ctx.Redirect(newURL, http.StatusMovedPermanently) + return } + + // it's a normal http request that needs to be redirected + u, err := url.Parse(fmt.Sprintf("https://%s%s%s", domain, portPart, ctx.Path())) + if err != nil { + log.Error().Err(err).Msg("could not craft http to https redirect") + ctx.String("", http.StatusInternalServerError) + } + + newURL := u.String() + log.Debug().Msgf("redirect http to https: %s", newURL) + ctx.Redirect(newURL, http.StatusMovedPermanently) } }