-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
enhancementFeature requests. Not bugs or questions.Feature requests. Not bugs or questions.help wantedNeeds help!Needs help!
Description
Feature Request: In lua http filter add ability to set the contents of the body
The idea is to be able to set the contents of the response body from lua.
This feature is helpful for providing a custom response in the event of an upstream failure.
For example, if a circuit breaker fails for an API that is expected to be JSON, a response of an empty json array could[]be returned instead of the messageupstream connect error or disconnect/reset before headers. reset reason: connection failurewhich would break an app expecting JSON.
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
http_filters:
- name: envoy.lua
config:
inline_code: |
function envoy_on_response(response_handle)
if response_handle:headers():get(":status") != "200" then
response_handle:body():set('[]')
end
endReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementFeature requests. Not bugs or questions.Feature requests. Not bugs or questions.help wantedNeeds help!Needs help!