debug: output mismatched backend host
This commit is contained in:
@@ -135,8 +135,11 @@ func (state *State) handleRequest(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
data := challenge.RequestDataFromContext(r.Context())
|
data := challenge.RequestDataFromContext(r.Context())
|
||||||
|
|
||||||
|
lg := state.Logger(r)
|
||||||
|
|
||||||
backend := state.GetBackend(host)
|
backend := state.GetBackend(host)
|
||||||
if backend == nil {
|
if backend == nil {
|
||||||
|
lg.Debug("no backend for host", "host", host)
|
||||||
http.Error(w, http.StatusText(http.StatusServiceUnavailable), http.StatusServiceUnavailable)
|
http.Error(w, http.StatusText(http.StatusServiceUnavailable), http.StatusServiceUnavailable)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -154,8 +157,6 @@ func (state *State) handleRequest(w http.ResponseWriter, r *http.Request) {
|
|||||||
return backend
|
return backend
|
||||||
}
|
}
|
||||||
|
|
||||||
lg := state.Logger(r)
|
|
||||||
|
|
||||||
cleanupRequest := func(r *http.Request, fromChallenge bool) {
|
cleanupRequest := func(r *http.Request, fromChallenge bool) {
|
||||||
if fromChallenge {
|
if fromChallenge {
|
||||||
r.Header.Del("Referer")
|
r.Header.Del("Referer")
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ func (b *Bind) Server(backends map[string]http.Handler, acmeCachePath string) (*
|
|||||||
swap(http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
swap(http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
backend := utils.SelectHTTPHandler(backends, r.Host)
|
backend := utils.SelectHTTPHandler(backends, r.Host)
|
||||||
if backend == nil {
|
if backend == nil {
|
||||||
|
slog.Debug("no backend for host", "host", r.Host)
|
||||||
http.Error(w, http.StatusText(http.StatusBadGateway), http.StatusBadGateway)
|
http.Error(w, http.StatusText(http.StatusBadGateway), http.StatusBadGateway)
|
||||||
} else {
|
} else {
|
||||||
backend.ServeHTTP(w, r)
|
backend.ServeHTTP(w, r)
|
||||||
|
|||||||
Reference in New Issue
Block a user