I use envoy as a reverse proxy but I found that it has a max response header limit. I use envoy to proxy an upstream server, which will use this codes to add a lot of response headers:
func handleRequest(ctx *gin.Context) {
headerNum := 97
for i := 0; i < headerNum; i ++ {
ctx.Writer.Header().Add("X", fmt.Sprintf("%03d", i))
}
ctx.String(http.StatusOK, "ok")
}
And I noticed that if I set headerNum to 98 and request envoy proxy for accessing this upstream server, I will get an error and have a 503 status code:
upstream connect error or disconnect/reset before headers. reset reason: connection termination
It seems that envoy has a limit for the number of response header. So where can I set this configuration?
Also If I use ext_authz to send lots of headers from external auth server to upstream servers, this header limit can also influence this function.
@weixiao-huang Http connections have an option max_headers_count to it. See max_headers_count and max_response_headers_count.
You set it through common_http_protocol_options in your cluster configuration
It works! Thanks for your answer!