|
|
@ -42,15 +42,17 @@ The following example configures the Lua Envoy extension on every service by usi
|
|
|
|
<CodeBlockConfig filename="lua-envoy-extension-proxy-defaults.hcl">
|
|
|
|
<CodeBlockConfig filename="lua-envoy-extension-proxy-defaults.hcl">
|
|
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
```hcl
|
|
|
|
Kind = "proxy-defaults"
|
|
|
|
Kind = "proxy-defaults"
|
|
|
|
Name = "global"
|
|
|
|
Name = "global"
|
|
|
|
Protocol = "http"
|
|
|
|
Config {
|
|
|
|
|
|
|
|
protocol = "http"
|
|
|
|
|
|
|
|
}
|
|
|
|
EnvoyExtensions {
|
|
|
|
EnvoyExtensions {
|
|
|
|
Name = "builtin/lua"
|
|
|
|
Name = "builtin/lua"
|
|
|
|
Arguments = {
|
|
|
|
Arguments = {
|
|
|
|
ProxyType = "connect-proxy"
|
|
|
|
ProxyType = "connect-proxy"
|
|
|
|
Listener = "inbound"
|
|
|
|
Listener = "inbound"
|
|
|
|
Script = <<-EOS
|
|
|
|
Script = <<-EOF
|
|
|
|
function envoy_on_request(request_handle)
|
|
|
|
function envoy_on_request(request_handle)
|
|
|
|
meta = request_handle:streamInfo():dynamicMetadata()
|
|
|
|
meta = request_handle:streamInfo():dynamicMetadata()
|
|
|
|
m = meta:get("consul")
|
|
|
|
m = meta:get("consul")
|
|
|
@ -59,7 +61,7 @@ function envoy_on_request(request_handle)
|
|
|
|
request_handle:headers():add("x-consul-datacenter", m["datacenter"])
|
|
|
|
request_handle:headers():add("x-consul-datacenter", m["datacenter"])
|
|
|
|
request_handle:headers():add("x-consul-trust-domain", m["trust-domain"])
|
|
|
|
request_handle:headers():add("x-consul-trust-domain", m["trust-domain"])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
EOS
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
```
|
|
|
|