diff --git a/api/_routers/03-host_detection.go b/api/_routers/03-host_detection.go index a5e2ffb5ee2c8c746619f7837b92760735bf9574..620518e8b40cfd74f1fd0a45ec3e1ed93819f5c3 100644 --- a/api/_routers/03-host_detection.go +++ b/api/_routers/03-host_detection.go @@ -59,7 +59,7 @@ func (h *HostRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) { "action": GetActionName(r), "method": r.Method, }).Inc() - logger.Warn("The server name provided in the Host header is not configured, or the request was made directly to the media repo. Please specify a Host header and check your reverse proxy configuration. The request is being rejected.") + logger.Warnf("The server name provided ('%s') in the Host header is not configured, or the request was made directly to the media repo. Please specify a Host header and check your reverse proxy configuration. The request is being rejected.", r.Host) w.WriteHeader(http.StatusBadGateway) if b, err := json.Marshal(_responses.BadGatewayError("Review server logs to continue")); err != nil { panic(errors.New("error preparing BadGatewayError: " + err.Error())) diff --git a/test/test_internals/util_client.go b/test/test_internals/util_client.go index 16d839bd4612971696d054dddbaf5d4cc8549ba3..da21c6304e3e69c5e105661664c7260c8f32b62c 100644 --- a/test/test_internals/util_client.go +++ b/test/test_internals/util_client.go @@ -65,6 +65,9 @@ func (c *MatrixClient) DoRaw(method string, endpoint string, qs url.Values, cont if err != nil { return nil, err } + if c.ServerName != "" { + req.Host = c.ServerName + } if contentType != "" { req.Header.Set("Content-Type", contentType) } @@ -72,6 +75,6 @@ func (c *MatrixClient) DoRaw(method string, endpoint string, qs url.Values, cont req.Header.Set("Authorization", "Bearer "+c.AccessToken) } - log.Println(fmt.Sprintf("[HTTP] [Auth=%s] %s %s", c.AccessToken, req.Method, req.RequestURI)) + log.Println(fmt.Sprintf("[HTTP] [Auth=%s] [Host=%s] %s %s", c.AccessToken, c.ServerName, req.Method, req.URL.String())) return http.DefaultClient.Do(req) }