.. _envoy_v3_api_file_envoy/extensions/filters/http/lua/v3/lua.proto: Lua (proto) =========== .. _extension_envoy.filters.http.lua: 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: - :ref:`envoy.filters.http ` This extension must be configured with one of the following type URLs: - :ref:`type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua ` - :ref:`type.googleapis.com/envoy.extensions.filters.http.lua.v3.LuaPerRoute ` Lua :ref:`configuration overview `. .. _envoy_v3_api_msg_extensions.filters.http.lua.v3.Lua: extensions.filters.http.lua.v3.Lua ---------------------------------- :repo:`[extensions.filters.http.lua.v3.Lua proto] ` .. code-block:: json :force: { "inline_code": ..., "source_codes": {...}, "default_source_code": {...}, "stat_prefix": ... } .. _envoy_v3_api_field_extensions.filters.http.lua.v3.Lua.inline_code: 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 :ref:`default_source_code `. Only one of :ref:`inline_code ` or :ref:`default_source_code ` can be set for the Lua filter. .. _envoy_v3_api_field_extensions.filters.http.lua.v3.Lua.source_codes: source_codes (**repeated** map<`string `_, :ref:`config.core.v3.DataSource `>) Map of named Lua source codes that can be referenced in :ref:`LuaPerRoute `. The Lua source codes can be loaded from inline string or local files. Example: .. code-block:: yaml source_codes: hello.lua: inline_string: | function envoy_on_response(response_handle) -- Do something. end world.lua: filename: /etc/lua/world.lua .. _envoy_v3_api_field_extensions.filters.http.lua.v3.Lua.default_source_code: default_source_code (:ref:`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. .. _envoy_v3_api_field_extensions.filters.http.lua.v3.Lua.stat_prefix: 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: .. code-block:: yaml 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. .. _envoy_v3_api_msg_extensions.filters.http.lua.v3.LuaPerRoute: extensions.filters.http.lua.v3.LuaPerRoute ------------------------------------------ :repo:`[extensions.filters.http.lua.v3.LuaPerRoute proto] ` .. code-block:: json :force: { "disabled": ..., "name": ..., "source_code": {...} } .. _envoy_v3_api_field_extensions.filters.http.lua.v3.LuaPerRoute.disabled: 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 :ref:`disabled `, :ref:`name `, :ref:`source_code ` must be set. .. _envoy_v3_api_field_extensions.filters.http.lua.v3.LuaPerRoute.name: name (`string `_) A name of a Lua source code stored in :ref:`Lua.source_codes `. Precisely one of :ref:`disabled `, :ref:`name `, :ref:`source_code ` must be set. .. _envoy_v3_api_field_extensions.filters.http.lua.v3.LuaPerRoute.source_code: source_code (:ref:`config.core.v3.DataSource `) A configured per-route Lua source code that can be served by RDS or provided inline. Precisely one of :ref:`disabled `, :ref:`name `, :ref:`source_code ` must be set.