mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 22:06:57 +00:00
fix lint
This commit is contained in:
parent
e008cc446d
commit
f259180aed
1 changed files with 12 additions and 12 deletions
|
@ -66,18 +66,18 @@ func SetupHTTPACMEChallengeServer(challengeCache cache.SetGetKey, sslPort uint)
|
||||||
}
|
}
|
||||||
log.Info().Msgf("HTTP-ACME challenge for '%s' succeeded", domain)
|
log.Info().Msgf("HTTP-ACME challenge for '%s' succeeded", domain)
|
||||||
ctx.String(challenge.(string))
|
ctx.String(challenge.(string))
|
||||||
|
return
|
||||||
} 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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue