Lua (proto)

This extension has 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 category:

This extension must be configured with one of the following type URLs:

Lua configuration overview.

extensions.filters.http.lua.v3.Lua

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

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

(string) 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.

This field is deprecated. Please use default_source_code. Only one of inline_code or default_source_code can be set for the Lua filter.

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
default_source_code

(config.core.v3.DataSource) The default Lua code that Envoy will execute. If no per route config is provided for the request, this Lua code will be applied.

stat_prefix

(string) Optional additional prefix to use when emitting statistics. By default metrics are emitted in .lua. namespace. If multiple lua filters are configured in a filter chain, the stats from each filter instance can be emitted using custom stat prefix to distinguish emitted statistics. For example:

http_filters:
  - name: envoy.filters.http.lua
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
      stat_prefix: foo_script # This emits lua.foo_script.errors etc.
  - name: envoy.filters.http.lua
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
      stat_prefix: bar_script # This emits lua.bar_script.errors etc.

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.