diff --git a/modules/frontend/pipeline/sync_handler_adjust_response_code.go b/modules/frontend/pipeline/sync_handler_adjust_response_code.go index a7c9a362af1..e9d6a3ab39f 100644 --- a/modules/frontend/pipeline/sync_handler_adjust_response_code.go +++ b/modules/frontend/pipeline/sync_handler_adjust_response_code.go @@ -44,8 +44,9 @@ func (c statusCodeAdjustWare) RoundTrip(req Request) (*http.Response, error) { // if the frontend issues a bad request then externally we need to represent that as an // internal error // exceptions + // 413 - request entity too large // 429 - too many requests - if resp.StatusCode >= 400 && resp.StatusCode < 500 && resp.StatusCode != 429 { + if resp.StatusCode >= 400 && resp.StatusCode < 500 && resp.StatusCode != 429 && resp.StatusCode != 413 { resp.StatusCode = http.StatusInternalServerError resp.Status = http.StatusText(http.StatusInternalServerError) // leave the body alone. it will preserve the original error message diff --git a/modules/querier/http.go b/modules/querier/http.go index 247d512445f..307c65c3af0 100644 --- a/modules/querier/http.go +++ b/modules/querier/http.go @@ -427,7 +427,7 @@ func handleError(w http.ResponseWriter, err error) { // todo: better understand all errors returned from queriers and categorize more as 4XX if errors.Is(err, trace.ErrTraceTooLarge) { - http.Error(w, err.Error(), http.StatusBadRequest) + http.Error(w, err.Error(), http.StatusRequestEntityTooLarge) return }