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())
|
||||
|
||||
lg := state.Logger(r)
|
||||
|
||||
backend := state.GetBackend(host)
|
||||
if backend == nil {
|
||||
lg.Debug("no backend for host", "host", host)
|
||||
http.Error(w, http.StatusText(http.StatusServiceUnavailable), http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
@@ -154,8 +157,6 @@ func (state *State) handleRequest(w http.ResponseWriter, r *http.Request) {
|
||||
return backend
|
||||
}
|
||||
|
||||
lg := state.Logger(r)
|
||||
|
||||
cleanupRequest := func(r *http.Request, fromChallenge bool) {
|
||||
if fromChallenge {
|
||||
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) {
|
||||
backend := utils.SelectHTTPHandler(backends, r.Host)
|
||||
if backend == nil {
|
||||
slog.Debug("no backend for host", "host", r.Host)
|
||||
http.Error(w, http.StatusText(http.StatusBadGateway), http.StatusBadGateway)
|
||||
} else {
|
||||
backend.ServeHTTP(w, r)
|
||||
|
Reference in New Issue
Block a user