--Hi,here's my lua script:function envoy_on_request(request_handle)
-- Response directly and set a header from the HTTP call. No further filter iteration
-- occurs.
request_handle:respond(
{[":status"] = "403",
["upstream_foo"] = "abb"},
"nope")
end
function envoy_on_response(response_handle)
response_handle:headers():add("X-Test-H", "Test")
endas the manual reads:respond()
Respond immediately and do not continue further filter iteration. This call is only valid in the request flow.but i still get the response from upstream with the "X-Test-H" header added. How to respond the downstream immediately?
You received this message because you are subscribed to the Google Groups "envoy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to envoy-users+unsubscribe@googlegroups.com.
To post to this group, send email to envoy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/envoy-users/611f5506-e1de-43ca-9fa6-fad70e1af2ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The reason for this is when your request handler responds, it goes through the response filters, which includes the Lua filter, and your Lua response function runs which adds the header.This was brought up recently in a different PR. We need to only run encoder filters downstream of the filter that sends a local reply. Also unfortunately IIRC there is no way for your request and response functions to communicate with each other currently. You could potentially do something hacky like look for a header that only the router sets, such as x-envoy-upstream-service-time (or something like that).On Fri, May 25, 2018 at 1:31 AM, <zal...@gmail.com> wrote:Hi,here's my lua script:function envoy_on_request(request_handle)
-- Response directly and set a header from the HTTP call. No further filter iteration
-- occurs.
request_handle:respond(
{[":status"] = "403",
["upstream_foo"] = "abb"},
"nope")
end
function envoy_on_response(response_handle)
response_handle:headers():add("X-Test-H", "Test")
endas the manual reads:respond()
Respond immediately and do not continue further filter iteration. This call is only valid in the request flow.but i still get the response from upstream with the "X-Test-H" header added. How to respond the downstream immediately?
--
You received this message because you are subscribed to the Google Groups "envoy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to envoy-users...@googlegroups.com.