-
Notifications
You must be signed in to change notification settings - Fork 708
Closed
Description
Description:
When following the example on Lua Extensions, with the code below, it is currently not possible to get any header value.
As explained in the docs, we use the API of Lua to get the header values.
Repro steps:
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyExtensionPolicy
metadata:
name: lua-valueref-test
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: HTTPRoute
name: backend
lua:
- type: ValueRef
valueRef:
name: cm-lua-valueref
kind: ConfigMap
group: v1
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-lua-valueref
data:
lua: |
function envoy_on_response(response_handle)
response_handle:headers():add("x-lua-custom", "FOO")
response_handle:logInfo(response_handle:headers():get(":x-lua-custom"))
response_handle:logInfo(response_handle:headers():get("x-lua-custom"))
end
Instead of FOO, this will log example_value, probably because of mocks.lua. Neither with : or without : works.
Setting the header works, however.
Similarly, the following code (taken from Script Examples will also just give example_value.
function envoy_on_request(request_handle)
request_handle:logInfo("Method: "..request_handle:headers():get(":method"))
request_handle:logInfo("Path: "..request_handle:headers():get(":path"))
end
Last but not least, running the code below won't instruct Envoy to return 404. Instead, it will simply pass on the request to the backend.
request_handle:respond({[":status"] = "404"}, "This isn't working.")
However, in the log we can see the following.
2025-09-09 15:47:08.118
[INFO]: Responding with status: 404
Environment:
We deploy the Envoy Helm chart v1.5.0 into our v1.33.2 Kubernetes cluster.
Logs:
2025-09-09 15:29:50.359 | [INFO]: Path: example_value
2025-09-09 15:29:50.359 | [INFO]: Method: example_value
Reactions are currently unavailable