RESPONSE_CODE_DETAILS in access log does not show the reason for Upstream Protocol Error
- Dominant language
- C++
- Stars
- 28.9k
- Forks
- 5.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 437
Description
*Title*: *RESPONSE_CODE_DETAILS does not show the reason for Upstream Protocol Error*
*Description*:
When I proxy a HTTP request through Envoy, and the upstream returns too many headers, the `%RESPONSE_CODE_DETAILS%` in the access log shows `upstream_reset_before_response_started{protocol_error}` which does not give any more information than the flag `UPE`.
According to the [Envoy docs](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/response_code_details) I would expect something that contains the string `http1.too_many_headers`.
*Repro steps*:
I created a reproducer at https://github.com/robertpanzer/envoy-access-log
In short, when a response is rejected by Envoy due to too many headers, or too many header bytes, the access log shows RESPONSE_CODE_DETAILS like this:
```
[2023-04-12T07:20:50.890Z] "GET /toomanyheaders HTTP/1.1" 502 UPE upstream_reset_before_response_started{protocol_error} - "-" 0 87 92 - "-" "curl/7.87.0" "10316164-77c6-4ea4-a7a1-4371dbb1aa24" "localhost:8887" "-" "-" "-" "- " "-" "192.168.0.225:8888" inbound 172.17.0.3:40112 172.17.0.3:8887 172.17.0.1:37802 - -
[2023-04-12T07:21:07.746Z] "GET /toomanyheaderbytes HTTP/1.1" 502 UPE upstream_reset_before_response_started{protocol_error} - "-" 0 87 721 - "-" "curl/7.87.0" "b51c8970-30c8-42bc-aa3b-26de4daeec4b" "localhost:8887" "-" "-" "-" "- " "-" "192.168.0.225:8888" inbound 172.17.0.3:48298 172.17.0.3:8887 172.17.0.1:48050 - -
```
This log makes it harder to spot the reason for why the response was rejected.
Tested on the latest Envoy 1.25.4, as well as Istio Proxy 1.10 and 1.15.
*Config*:
Config is available in the reproducer repo at https://github.com/robertpanzer/envoy-access-log
*Logs*:
```
[2023-04-12T07:20:50.890Z] "GET /toomanyheaders HTTP/1.1" 502 UPE upstream_reset_before_response_started{protocol_error} - "-" 0 87 92 - "-" "curl/7.87.0" "10316164-77c6-4ea4-a7a1-4371dbb1aa24" "localhost:8887" "-" "-" "-" "- " "-" "192.168.0.225:8888" inbound 172.17.0.3:40112 172.17.0.3:8887 172.17.0.1:37802 - -
[2023-04-12T07:21:07.746Z] "GET /toomanyheaderbytes HTTP/1.1" 502 UPE upstream_reset_before_response_started{protocol_error} - "-" 0 87 721 - "-" "curl/7.87.0" "b51c8970-30c8-42bc-aa3b-26de4daeec4b" "localhost:8887" "-" "-" "-" "- " "-" "192.168.0.225:8888" inbound 172.17.0.3:48298 172.17.0.3:8887 172.17.0.1:48050 - -
```
Contributor guide
Assessment
This issue has not been assessed yet.