[Feature Request] Support adding response flags and response code details in custom response headers
#11 648 ouverte le 18 juin 2020
Métriques du dépôt
- Stars
- (27 997 stars)
- Métriques de merge PR
- (Merge moyen 8j) (378 PRs mergées en 30 j)
Description
Description: Envoy supports adding a set of custom request/response headers and also dynamic values in those headers. By adding headers with RESPONSE_CODE_DETAILS and RESPONSE_FLAGS, we provide additional context to clients whether the response code has come from Envoy or the upstream backend, as well as why the request has failed.
Envoy currently has some support for RESPONSE_CODE_DETAILS and RESPONSE_FLAGS as custom headers, but we observed that in cases where the Envoy sidecar sends a local 503 response, for example, when there are no healthy upstreams, custom headers are not getting added to the responses. Investigating the issue, we noticed that finalizeResponseHeaders are not called when the Envoy Router sendLocalReply.
callbacks_->sendLocalReply(Http::Code::ServiceUnavailable, "no healthy upstream", modify_headers_, absl::nullopt, StreamInfo::ResponseCodeDetails::get().NoHealthyUpstream);
A possible solution might be to call finalizeResponseHeaders in modify_headers_ for cases that Envoy sends a local reply.
[optional Relevant Links:] Custom request/response header Envoy doc: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#custom-request-response-headers https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format-response-flags