Skip to content

Create upstream response body in LUA when it is NIL #14226

@s-vivien

Description

@s-vivien

The LUA filter documentation states that you can override the upstream response body by doing this :

function envoy_on_response(response_handle)
  local content_length = response_handle:body():setBytes("<html><b>Not Found<b></html>")
  response_handle:headers():replace("content-length", content_length)
  response_handle:headers():replace("content-type", "text/html")
end

However, in some cases, the upstream response has no body, thus making it impossible to change its content.

Is there a workaround for this ? If not, that could be an interesting feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions