title: How to make a lua envoy filter work on the istio cluster?
body: <p>I am trying to get a lua envoy filter to work with istio gateway, but I added to the cluster and it is working as if the filter does not exists.</p>
  
  <p>I have configured my istio cluster on GKE using this guide <a href="https://istio.io/docs/setup/kubernetes/install/kubernetes/" rel="nofollow noreferrer">https://istio.io/docs/setup/kubernetes/install/kubernetes/</a>.</p>
  
  <p>Have anyone had the same problem?</p>
  
  <pre><code>apiVersion: networking.istio.io/v1alpha3
  kind: EnvoyFilter
  metadata:
    name: edge-lua-filter
  spec:
    workloadLabels:
      app: httpbin-gateway
    filters:
    - listenerMatch:
        listenerType: GATEWAY
      filterName: envoy.lua
      filterType: HTTP
      filterConfig:
        inlineCode: |
          -- Called on the request path.
          function envoy_on_request(request_handle)
              request_handle:headers():add("foo", "bar")
          end
          -- Called on the response path.
          function envoy_on_response(response_handle)
              body_size = response_handle:body():length()
              response_handle:headers():add("response-body-size", tostring(body_size))
          end
  </code></pre>
  
  <pre><code>apiVersion: networking.istio.io/v1alpha3
  kind: Gateway
  metadata:
    name: httpbin-gateway
    namespace: foo
  spec:
    selector:
      istio: ingressgateway # use Istio default gateway implementation
    servers:
    - port:
        number: 80
        name: http
        protocol: HTTP
      hosts:
      - "*"
  </code></pre>
  
  <pre><code>apiVersion: networking.istio.io/v1alpha3
  kind: VirtualService
  metadata:
    name: httpbin
    namespace: foo
  spec:
    hosts:
    - "*"
    gateways:
    - httpbin-gateway
    http:
    - route:
      - destination:
          port:
            number: 8000
          host: httpbin.foo.svc.cluster.local
  </code></pre>