Hi, when HAProxy rec vies a 500 from a backend it will respond with 502 to the client. Is there any way to prevent this and just forward the 500 response?
That’s not expected behavior, however it is more likely that one of the following cases apply:
502 when the server returns an empty, invalid or incomplete response, or when an “http-response deny” rule blocks the response.
Check your configuration, check haproxy logs, issue
show errors on the admin socket or capture the server response to check if it’s valid.
I produce the error code controlled. So I am able to test with any code I want. Well it turns out that I get the error page from the backend for every response.
<% response.sendError(501, "i dont like"); %>
except when the status code is 500.
<% response.sendError(500, "test this"); %>
Like I said:
show errors on the admin socket and a full packet capture is required.
Also the entire haproxy configuration as well as the output of
thanks for motivating me to dig deeper. The issue was that HAProxy would retry on 500 but there was no other server to retry.
retries 1 retry-on all-retryable-errors option redispatch 1
When I comment those out I get the 500.