From e4e91e1a86b45786d800e3af0c5b8f79bc845237 Mon Sep 17 00:00:00 2001 From: Robert Butts Date: Wed, 24 Feb 2021 11:37:34 -0700 Subject: [PATCH] Fix parent.config to 504 not 502 on timeout --- proxy/http/HttpTransact.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 6e53a9af21b..3669169e277 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -7471,10 +7471,18 @@ HttpTransact::handle_parent_died(State *s) { ink_assert(s->parent_result.result == PARENT_FAIL); - if (s->current.state == OUTBOUND_CONGESTION) { + switch (s->current.state) { + case OUTBOUND_CONGESTION: build_error_response(s, HTTP_STATUS_SERVICE_UNAVAILABLE, "Next Hop Congested", "congestion#retryAfter"); - } else { - build_error_response(s, HTTP_STATUS_BAD_GATEWAY, "Next Hop Connection Failed", "connect#failed_connect"); + break; + case INACTIVE_TIMEOUT: + build_error_response(s, HTTP_STATUS_GATEWAY_TIMEOUT, "Next Hop Timeout", "timeout#inactivity"); + break; + case ACTIVE_TIMEOUT: + build_error_response(s, HTTP_STATUS_GATEWAY_TIMEOUT, "Next Hop Timeout", "timeout#activity"); + break; + default: + build_error_response(s, HTTP_STATUS_BAD_GATEWAY, "Next Hop Connection Failed", "connect"); } TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, nullptr); }