-
Notifications
You must be signed in to change notification settings - Fork 200
fix: map proxy errors to correct HTTP status codes) #765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: map proxy errors to correct HTTP status codes) #765
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ipochi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
619e98f
to
939a08c
Compare
Previously, the apiserver-network-proxy returned a blanket 503 (Service Unavailable) status for all backend connection failures, which was incorrect for a proxy server. Additionally, HTTP CONNECT mode would send 200 OK immediately after hijacking, preventing proper error reporting but also violating HTTP CONNECT protocol This commit: - Adds mapDialErrorToHTTPStatus() to map TCP/network errors to appropriate HTTP status codes: * 502 Bad Gateway: connection refused, DNS failures, network unreachable * 503 Service Unavailable: resource exhaustion (too many open files) * 504 Gateway Timeout: I/O timeouts, deadline exceeded - Delays sending "200 Connection Established" until after successful backend connection in HTTP CONNECT mode - Ensures proper HTTP/1.1 protocol version in error responses - Preserves original error messages in response body for debugging Signed-off-by: Imran Pochi <[email protected]>
939a08c
to
4d6bd6b
Compare
Signed-off-by: Imran Pochi <[email protected]>
Looks like way back in commit #1 we considered returning structured error data:
To avoid parsing strings in the server, maybe now is the time to add that to the client (and keep But in general, I don't feel that I'm the best reviewer for non-trivial http-connect mode changes because I am mostly emeritus, and never deeply ramped on on the http-connect side, only the grpc side. Maybe @cheftako or another? |
Previously, the apiserver-network-proxy returned a blanket 503 (Service Unavailable) status for all backend connection failures, which was incorrect for a proxy server. Additionally, HTTP CONNECT mode would send 200 OK immediately after hijacking, preventing proper error reporting but also violating HTTP CONNECT protocol
This PR:
Fixes: #764