Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow respond in the response path #12974

Closed
ceastman-ibm opened this issue Sep 3, 2020 · 2 comments
Closed

Allow respond in the response path #12974

ceastman-ibm opened this issue Sep 3, 2020 · 2 comments
Labels
question Questions that are neither investigations, bugs, nor enhancements

Comments

@ceastman-ibm
Copy link

Title: One line description

Description:

Describe the the desired behavior, what scenario it enables and how it
would be used.

A microservice in the istio service mesh causes a 4xx or 5xx error, instead of just returning the status code to the browser. We have a microservice that renders a nice custom error page. We want to modify the response body to be this nicely rendered custom error page.

nginx has this functionaly, it would be great if envoy had it also.

[optional Relevant Links:]

Any extra documentation required to understand the issue.
here is the snippet of lua code inside the envoy_on_response function that I am trying to use:

        -- This section of code is for redirecting to maintenance if a 4xx or 5xx status code is detected
          if headerStatus ~= nil then
            if string.match(headerStatus, '[4-5].*') and headerStatus ~= "401" then
              response_headers, response_body = response_handle:httpCall(
                "outbound|80||maintenance.ondeck.svc.cluster.local",
                {
                  [":method"]   = "GET",
                  [":path"]     = "/maintenance/"..headerStatus,
                  [":authority"] = "maintenance.ondeck.svc.cluster.local"
                },
                "",
                1000
              )
              response_handle:respond(
                {[":status"] = "200",
                 ["envoy-fallback"] = "true"},
                response_body)

            end
          end

i get the following error:
[istio-ingressgateway-78bcc4574c-9pwmx] 2020-09-03T19:21:21.223613Z error envoy lua [external/envoy/source/extensions/filters/http/lua/lua_filter.cc:685] script log: [string "function encodeChar(chr)..."]:112: respond not currently supported in the response path

@ceastman-ibm ceastman-ibm added enhancement Feature requests. Not bugs or questions. triage Issue requires triage labels Sep 3, 2020
@mattklein123 mattklein123 added question Questions that are neither investigations, bugs, nor enhancements and removed enhancement Feature requests. Not bugs or questions. triage Issue requires triage labels Sep 7, 2020
@linsun
Copy link

linsun commented Sep 9, 2020

@ceastman-ibm is this same issue as #5998 or different?

@ceastman-ibm
Copy link
Author

@linsun looks to be the same issue, ill close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions that are neither investigations, bugs, nor enhancements
Projects
None yet
Development

No branches or pull requests

3 participants