Skip to content

Istio EnvoyFilter Causes 503 Errors

DodaTech Updated 2026-06-24 2 min read

You encounter a istio configuration issue that prevents your workflow from completing. This guide walks through the fix step by step.

Wrong ❌

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata: { name: my-filter }
spec:
  workloadSelector: { labels: { app: my-service } }
  configPatches:
    - applyTo: HTTP_FILTER
      match:
        context: SIDECAR_INBOUND
        listener: { portNumber: 8080, filterChain: { filter: { name: envoy.filters.network.http_connection_manager } } }
      patch:
        operation: INSERT_BEFORE
        value:
          name: envoy.filters.http.lua
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
            inline_code: |
              function envoy_on_request(request_handle)
                -- invalid lua crashes the filter
              end

Wrong Output

All requests return 503. Envoy logs: unable to load Lua filter. EnvoyFilter rejected.
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata: { name: my-filter }
spec:
  workloadSelector: { labels: { app: my-service } }
  configPatches:
    - applyTo: HTTP_FILTER
      match: { context: SIDECAR_INBOUND }
      patch:
        operation: INSERT_BEFORE
        value:
          name: envoy.filters.http.lua
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
            inline_code: |
              function envoy_on_request(request_handle)
                request_handle:headers():add("x-custom", "true")
              end

Right Output

Requests processed with x-custom header. Envoy proxy SYNCED. No errors.

Prevention

  • Test EnvoyFilter patches in staging first.
  • Validate Lua syntax before applying.
  • Use istioctl proxy-status to check sync.
  • Start simple and incrementally add complexity.
  • Check Envoy logs: kubectl logs -c istio-proxy.

DodaTech applies similar defensive patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro infrastructure for production reliability.

Common Mistakes with envoy filter

  1. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  2. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  3. Using return to exit a function early instead of wrapping a pure value in the monad

These mistakes appear frequently in real-world ISTIO code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

**Q: What is the most common cause of this istio error?**

A: Configuration drift between environments and version mismatches are the top causes. Always verify both before deeper troubleshooting.

Q: Can this error affect production traffic?

A: Yes. Depending on whether it occurs in the control plane or data plane, it can block all traffic or cause silent failures.

Q: How do I monitor for this error in production?

A: Set up log-based alerts for the error signature shown above. Most monitoring platforms support pattern matching on log entries.

Q: Is there a quick rollback procedure?

A: Revert the configuration change and restart the service. For data-plane errors, replay affected records from the source of truth.


This quick fix is part of the DodaTech infrastructure engineering series. Learn more at DodaTech tutorials.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro