Hello fellow envoy users!
I've run into some unusual behavior around setting the "Connection" header on responses from Envoy. The context is that I have Envoy acting as an inbound proxy, and have noticed that when no clusters are healthy, although it returns a 503, it keeps the connection open to the client. This results in the client continuing to send requests to the Envoy instance that has no healthy backends, and thus the client doesn't give up and go find another Envoy instance in our environment to communicate with. To deal with this, I'd like to be able to set "Connection: close" on this kind of response. I tried doing this with
the Lua filter, and found that I could set most headers, but not Connection. While investigating this further, I also found that the "response_headers_to_add" feature of configuration was
also unable to set Connection.
Basic example of my Lua configuration:
{ "name": "envoy.lua", "config": { "inline_code": "function envoy_on_response(response_handle)\n response_handle:headers():replace(\"connection\", \"close\")\nend" }
Is there a way to set this header in responses from Envoy? If not, is there some equivalent feature that could provide what I'm looking for--connection-close-based or tcp-based circuit breaking for clients who are talking to an Envoy instance with no healthy clusters?
Any guidance or help here is appreciated!
Sincerely,
Max