Lua

This extension may be referenced by the qualified name envoy.filters.http.lua

Note

This extension is intended to be robust against untrusted downstream traffic. It assumes that the upstream is trusted.

Tip

This extension extends and can be used with the following extension categories:

Lua configuration overview.

extensions.filters.http.lua.v3.Lua

[extensions.filters.http.lua.v3.Lua proto]

{
  "inline_code": "...",
  "source_codes": "{...}"
}
inline_code

(string, REQUIRED) The Lua code that Envoy will execute. This can be a very small script that further loads code from disk if desired. Note that if JSON configuration is used, the code must be properly escaped. YAML configuration may be easier to read since YAML supports multi-line strings so complex scripts can be easily expressed inline in the configuration.

source_codes

(repeated map<string, config.core.v3.DataSource>) Map of named Lua source codes that can be referenced in LuaPerRoute. The Lua source codes can be loaded from inline string or local files.

Example:

source_codes:
  hello.lua:
    inline_string: |
      function envoy_on_response(response_handle)
        -- Do something.
      end
  world.lua:
    filename: /etc/lua/world.lua

extensions.filters.http.lua.v3.LuaPerRoute

[extensions.filters.http.lua.v3.LuaPerRoute proto]

{
  "disabled": "...",
  "name": "...",
  "source_code": "{...}"
}
disabled

(bool) Disable the Lua filter for this particular vhost or route. If disabled is specified in multiple per-filter-configs, the most specific one will be used.

Precisely one of disabled, name, source_code must be set.

name

(string) A name of a Lua source code stored in Lua.source_codes.

Precisely one of disabled, name, source_code must be set.

source_code

(config.core.v3.DataSource) A configured per-route Lua source code that can be served by RDS or provided inline.

Precisely one of disabled, name, source_code must be set.