我将尝试在envoy的配置文件中实现lua脚本。
我想要的是在本地的lua文件中编写我的lua代码,然后在envoy的配置文件中指定我的脚本文件。
以下是我的YAML文件:
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
'@type': "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
stat_prefix: http_proxy
route_config:
name: all
virtual_hosts:
- name: allbackend_cluster
domains:
- '*'
routes:
- match: { prefix: "/"}
route:
cluster: cluster_wackopicko
http_filters:
- name: envoy.filters.http.router
- name: envoy.lua
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
inline_code: |
function envoy_on_response(response_handle)
body_size = response_handle:body():length()
response_handle:headers():add("response-body-size", tostring(body_size))
response_handle:headers():add("foo", "bar")
end
clusters:
- name: cluster_wackopicko
connect_timeout: 1s
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: cluster_wackopicko
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 8081
我需要在这个配置文件中做什么更改,才能将lua代码导出到位于我的Ubuntu服务器上的/envoy/lua/scripts/文件夹中的外部文件?