Configuring low-level envoy proxy settings in the consul-api-gateway

Hello, I was trying to follow this guide to configure the underlying envoy proxy of the consul-api-gateway. My goal was to add the Lua http filter to the envoy proxy in the consul-api-gateway.

My config file looks like this:

---
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
  name: global
spec:
  config:
    lua_filter:
      name: envoy.filters.http.lua
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
        inline_code: |
          -- Called on the response path.
          function envoy_on_response(response_handle)
            response_handle:headers():add("some_header", "some_value")
          end

I used the command kubectl apply -f filename.yaml to apply it. No matter what I do I can’t seem to get any config changes to work for the envoy proxy. Any advice as to what I’m doing wrong would be greatly appreciated. Thanks!

Hi @immabird unfortunately ProxyDefaults only apply to specific mesh service proxies (i.e. services that aren’t gateways). There have been some issues created some time ago to allow for adding escape hatch overrides to ingress gateways (API Gateways are custom ingress gateways):

and the corresponding GitHub issue here:

from a corresponding comment in another issue, it looks like we just got this put on an internal roadmap for the core Consul team, but I can’t give you an estimate as to when this would be supported yet:

Thanks for the detailed information! I was not aware there was a distinction between gateways and services I thought they were treated equally as part of the mesh. You saved me a lot of time because I was determined to keep trying things until it worked lol.

I am trying to do a similar thing but for specific proxies (pod level sidecar). To test I’m applying this as a global proxyDefault but it doesn’t seem to be working for me. Config is as follows:

apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
  name: global
spec:
  config:
    lua_filter:
      name: envoy.filters.http.lua
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
        inline_code: |
          -- Called on the response path.
          function envoy_on_response(response_handle)
            response_handle:headers():add("some_header", "some_value")
            responde_handle:logInfo("Logging Hello")
          end

But I don’t see the message “Logging Hello” in the stdout/logs.
Should I be applying this in a different way?