---
title: "API Gateway with Envoy: Deployment Patterns and Policy Ownership - API7.ai"
description: "Use Envoy as a gateway data plane, a standalone proxy, or a mesh component while making xDS, identity, authorization, retries, and failure behavior explicit."
url: "https://api7.ai/learning-center/api-gateway-guide/api-gateway-envoy"
---

[Skip to article](#column-content)

Column contentsAPI Gateway Guide

[API Gateway Guide](https://api7.ai/learning-center/api-gateway-guide)

Search this column

01 Gateway Fundamentals

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=fundamentals)[1. What Is an API Gateway? API Gateway Software and Use Cases](https://api7.ai/learning-center/api-gateway-guide/what-is-an-api-gateway)[2. Why Do Modern Architectures Need an API Gateway?](https://api7.ai/learning-center/api-gateway-guide/why-do-modern-architectures-need-api-gateway)[3. Reverse Proxy vs Load Balancer vs API Gateway](https://api7.ai/learning-center/api-gateway-guide/api-gateway-vs-reverse-proxy-vs-load-balancer)[4. API Gateway and Microservices: Decoupling and Traffic Management](https://api7.ai/learning-center/api-gateway-guide/api-gateway-and-microservices)[5. Understanding Core API Gateway Features](https://api7.ai/learning-center/api-gateway-guide/core-api-gateway-features)[6. Open Source vs. Commercial API Gateways: How to Choose the Right One?](https://api7.ai/learning-center/api-gateway-guide/open-source-vs-commercial-api-gateway)[7. API Gateway vs Service Mesh: How to Choose?](https://api7.ai/learning-center/api-gateway-guide/api-gateway-vs-service-mesh)[8. Envoy vs NGINX, Java, and Go for API Gateways](https://api7.ai/learning-center/api-gateway-guide/nginx-vs-envoy-vs-java-vs-go)[9. Core Concepts of API Gateway: Service, Route, Upstream, Plugin, and Consumer](https://api7.ai/learning-center/api-gateway-guide/core-concepts-of-api-gateway)[10. API Gateway Comparison: Apache APISIX vs. Kong vs. Traefik vs. KrakenD vs. Tyk](https://api7.ai/learning-center/api-gateway-guide/api-gateway-comparison-apisix-kong-traefik-krakend-tyk)

02 Gateway Architecture and Design

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=architecture)[11. Deep Dive into API Gateway Architecture: Core Components and Design Principles](https://api7.ai/learning-center/api-gateway-guide/api-gateway-architecture)[12. Choosing the Right API Gateway for Your Architecture](https://api7.ai/learning-center/api-gateway-guide/api-gateway-monolithic-vs-microservices)[13. How to Architect an API Gateway for High Availability (HA)?](https://api7.ai/learning-center/api-gateway-guide/api-gateway-high-availability)[14. API Gateway Plugin Architecture: How to Extend and Customize Your API Gateway](https://api7.ai/learning-center/api-gateway-guide/api-gateway-plugin-system)[15. How Event-Driven Architecture (EDA) Works with API Gateway?](https://api7.ai/learning-center/api-gateway-guide/api-gateway-event-driven-architecture)[16. API Gateway Request Lifecycle Explained](https://api7.ai/learning-center/api-gateway-guide/api-gateway-request-lifecycle-explained)[17. Cloud-Native API Gateway on Kubernetes](https://api7.ai/learning-center/api-gateway-guide/cloud-native-api-gateway-kubernetes)[18. API Gateway Control Plane vs. Data Plane](https://api7.ai/learning-center/api-gateway-guide/api-gateway-control-plane-vs-data-plane)[19. How API Gateways Work with GitOps: Automating API Management](https://api7.ai/learning-center/api-gateway-guide/api-gateway-gitops-integration)[20. How to Perform A/B Testing and Canary Releases with an API Gateway](https://api7.ai/learning-center/api-gateway-guide/ab-testing-canary-release-api-gateway)

03 Gateway Setup and Traffic Handling

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=traffic-protocols)[21. How to Deploy an API Gateway on Kubernetes: Step-by-Step Guide for Engineers](https://api7.ai/learning-center/api-gateway-guide/deploy-api-gateway-on-kubernetes)[22. Hands-on Setup with Apache APISIX API Gateway](https://api7.ai/learning-center/api-gateway-guide/api-gateway-getting-started-guide)[23. API Gateway Auth: OAuth 2.0, JWT & OIDC with APISIX](https://api7.ai/learning-center/api-gateway-guide/api-gateway-authentication-apache-apisix-oauth-jwt-oidc)[24. Mastering Traffic Control: Efficiently Managing API Requests with Gateways](https://api7.ai/learning-center/api-gateway-guide/api-gateway-traffic-control-strategies)[25. Building Reliable API Gateways with Logging and Monitoring](https://api7.ai/learning-center/api-gateway-guide/api-gateway-logging-monitoring-best-practices)[26. Dynamic Routing in API Gateways: Best Practices for Flexible Traffic Management](https://api7.ai/learning-center/api-gateway-guide/api-gateway-dynamic-routing-management)[27. How API Gateways Support WebSocket](https://api7.ai/learning-center/api-gateway-guide/how-api-gateways-support-websocket)[28. API Gateway for GraphQL: Security, Cost, and Caching](https://api7.ai/learning-center/api-gateway-guide/api-gateway-handle-graphql)[29. How API Gateways Handle HTTP/3 QUIC Requests](https://api7.ai/learning-center/api-gateway-guide/api-gateway-http3-quic)[30. How API Gateways Handle MQTT Requests](https://api7.ai/learning-center/api-gateway-guide/api-gateway-mqtt)

04 Gateway Integrations, AI, and MCP

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=ai-mcp)[31. How API Gateways Handle gRPC Requests](https://api7.ai/learning-center/api-gateway-guide/api-gateway-grpc-support)[32. How API Gateways Implement Custom Plugins](https://api7.ai/learning-center/api-gateway-guide/api-gateway-custom-plugins)[33. How API Gateways Integrate with Kafka](https://api7.ai/learning-center/api-gateway-guide/api-gateway-kafka-integration)[34. How to Implement API Aggregation in API Gateways](https://api7.ai/learning-center/api-gateway-guide/api-gateway-api-aggregation)[35. How API Gateways Enable Serverless Architecture](https://api7.ai/learning-center/api-gateway-guide/api-gateway-serverless-architecture)[36. How API Gateways Proxy LLM Requests](https://api7.ai/learning-center/api-gateway-guide/api-gateway-proxy-llm-requests)[37. How API Gateways Enhance MCP Servers](https://api7.ai/learning-center/api-gateway-guide/api-gateway-enhance-mcp-server)[38. MCP Gateway vs MCP Proxy vs AI Gateway vs API Gateway](https://api7.ai/learning-center/api-gateway-guide/ai-gateway-vs-mcp-gateway-vs-api-gateway)[39. What Is an AI Gateway? Architecture and Benefits](https://api7.ai/learning-center/api-gateway-guide/what-is-an-ai-gateway)[40. What Is an MCP Gateway? Architecture, Use Cases & How It Works (2026 Guide)](https://api7.ai/learning-center/api-gateway-guide/what-is-mcp-gateway)

05 Gateway Performance

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=performance)[41. How API Gateway Reduces Latency: Performance Optimization Strategies](https://api7.ai/learning-center/api-gateway-guide/how-api-gateway-reduces-latency)[42. API Gateway Caching Strategy: Comprehensive Analysis and Implementation Guide](https://api7.ai/learning-center/api-gateway-guide/api-gateway-caching-strategy-analysis)[43. How to Optimize API Gateway Load Balancing: Advanced Strategies and Best Practices](https://api7.ai/learning-center/api-gateway-guide/how-to-optimize-api-gateway-load-balancing)[44. How API Gateway Efficiently Handles Large-Scale Traffic: Architecture and Strategies](https://api7.ai/learning-center/api-gateway-guide/how-api-gateway-handles-large-scale-traffic)[45. How to Improve API Gateway QoS: Traffic Classes, Capacity Protection, and SLOs](https://api7.ai/learning-center/api-gateway-guide/api-gateway-quality-of-service)[46. API Gateway Log Storage: Pipelines, Retention, Security, and Cost](https://api7.ai/learning-center/api-gateway-guide/api-gateway-log-storage)[47. API Gateway Timeouts and Retries: Safe Policies and APISIX Configuration](https://api7.ai/learning-center/api-gateway-guide/api-gateway-timeouts-retries)[48. API Gateway Concurrency Control: Capacity Budgets, Backpressure, and Load Shedding](https://api7.ai/learning-center/api-gateway-guide/api-gateway-concurrency-control)[49. Asynchronous API Gateway Patterns: Queues, Callbacks, and Performance Boundaries](https://api7.ai/learning-center/api-gateway-guide/asynchronous-api-gateway-patterns)[50. API Gateway TLS Performance: Handshakes, Session Reuse, and Measurement](https://api7.ai/learning-center/api-gateway-guide/api-gateway-tls-performance)

06 Gateway Security

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=security)[51. DDoS Defense at the API Gateway: Layered Controls and Failure Planning](https://api7.ai/learning-center/api-gateway-guide/api-gateway-ddos-defense)[52. Distributed API Gateway Rate Limiting: Local vs Redis Counters and Accuracy Trade-offs](https://api7.ai/learning-center/api-gateway-guide/distributed-api-gateway-rate-limiting)[53. API Gateway IP Allowlist and Denylist Management: Trust, Proxies, and Operations](https://api7.ai/learning-center/api-gateway-guide/api-gateway-ip-allowlist-denylist-management)[54. API Gateway Security Scanning: What to Test and How to Operationalize Findings](https://api7.ai/learning-center/api-gateway-guide/api-gateway-security-scanning)[55. SQL Injection and XSS at the API Gateway: Detection Limits and Defense in Depth](https://api7.ai/learning-center/api-gateway-guide/sql-injection-xss-api-gateway)[56. API Access Log Auditing: Evidence, Integrity, Retention, and Review](https://api7.ai/learning-center/api-gateway-guide/api-access-log-auditing)[57. Preventing API Scraping and Abuse: Identity, Behavioral Signals, and Rate Controls](https://api7.ai/learning-center/api-gateway-guide/prevent-api-scraping-abuse)[58. API Gateway mTLS: Client Identity, Certificate Rotation, and APISIX Configuration](https://api7.ai/learning-center/api-gateway-guide/api-gateway-mtls)[59. Fine-Grained API Gateway Authorization: RBAC, ABAC, and External Policy Decisions](https://api7.ai/learning-center/api-gateway-guide/fine-grained-api-gateway-authorization)[60. API Gateway and WAF Reference Architecture: Ownership, Header Trust, and Failure Modes](https://api7.ai/learning-center/api-gateway-guide/api-gateway-waf-reference-architecture)

07 Gateway Ecosystem and Comparisons

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=ecosystem)[61. Apache APISIX vs Kong: Migration, Operations, and Team Fit](https://api7.ai/learning-center/api-gateway-guide/apache-apisix-vs-kong)[62. Traefik vs Kong vs APISIX: A Reproducible API Gateway Benchmark Method](https://api7.ai/learning-center/api-gateway-guide/traefik-kong-apisix-benchmark-method)[63. Amazon API Gateway Explained: Deployment Models, Trade-offs, and Use Cases](https://api7.ai/learning-center/api-gateway-guide/amazon-api-gateway-explained)[64. API Gateway and Istio: Clear North-South and East-West Boundaries](https://api7.ai/learning-center/api-gateway-guide/api-gateway-istio)[65. API Gateway with NGINX: Layering, Ownership, and Migration Patterns](https://api7.ai/learning-center/api-gateway-guide/api-gateway-nginx)[66. API Gateway with Envoy: Deployment Patterns and Policy Ownership](https://api7.ai/learning-center/api-gateway-guide/api-gateway-envoy)[67. API Gateway with Cloudflare API Shield: Edge and Origin Security Boundaries](https://api7.ai/learning-center/api-gateway-guide/api-gateway-cloudflare-api-shield)[68. Apigee vs MuleSoft vs Amazon API Gateway: A Decision Framework](https://api7.ai/learning-center/api-gateway-guide/apigee-mulesoft-amazon-api-gateway)[69. Should an API Gateway Connect Directly to a Database? Patterns and Risks](https://api7.ai/learning-center/api-gateway-guide/api-gateway-database-access-patterns)[70. API Gateway Architecture for Large-Scale SaaS Platforms](https://api7.ai/learning-center/api-gateway-guide/api-gateway-large-scale-saas-architecture)

08 Industry Applications and Integrations

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=applications)[71. API Gateway CI/CD: Validation, Promotion, and Safe Rollback](https://api7.ai/learning-center/api-gateway-guide/api-gateway-ci-cd)[72. API Gateways for AI and ML Inference: Traffic, Security, and Observability](https://api7.ai/learning-center/api-gateway-guide/api-gateways-ai-ml-inference)[73. API Gateway Architecture for Financial Services: Controls and Failure Boundaries](https://api7.ai/learning-center/api-gateway-guide/api-gateway-financial-services)[74. API Gateway Architecture for E-Commerce: Checkout Reliability and Traffic Peaks](https://api7.ai/learning-center/api-gateway-guide/api-gateway-ecommerce)[75. API Gateways for Mobile Applications: Authentication, Payloads, and Versioning](https://api7.ai/learning-center/api-gateway-guide/api-gateways-mobile-applications)[76. API Gateways for Web3 Applications: RPC Traffic, Identity, and Abuse Controls](https://api7.ai/learning-center/api-gateway-guide/api-gateways-web3-applications)[77. OpenAPI-Driven API Gateway Operations: Import, Validation, and Drift Control](https://api7.ai/learning-center/api-gateway-guide/openapi-driven-api-gateway-operations)[78. gRPC-Web and gRPC Transcoding Through an API Gateway](https://api7.ai/learning-center/api-gateway-guide/grpc-web-grpc-transcoding-api-gateway)[79. API Gateway Pricing and Cost Optimization: A Workload-Based Model](https://api7.ai/learning-center/api-gateway-guide/api-gateway-pricing-cost-optimization)[80. Evaluating API Gateway Directions: Evidence and Architectural Impact](https://api7.ai/learning-center/api-gateway-guide/api-gateway-trends)

09 Advanced Gateway Applications

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=operations)[81. API Gateways in Zero Trust Architecture: Identity, Policy, and Limits](https://api7.ai/learning-center/api-gateway-guide/api-gateways-zero-trust-architecture)[82. API Gateway Log Analytics: Correlation, Queries, and Operational Signals](https://api7.ai/learning-center/api-gateway-guide/api-gateway-log-analytics)[83. From API Sprawl to Governed Delivery: The Gateway's Role in Modernization](https://api7.ai/learning-center/api-gateway-guide/api-gateway-modernization)[84. API Monetization at the Gateway: Plans, Metering, Entitlements, and Billing Boundaries](https://api7.ai/learning-center/api-gateway-guide/api-monetization-gateway)[85. Safe AI-Assisted API Gateway Optimization: Recommendations, Guardrails, and Approval](https://api7.ai/learning-center/api-gateway-guide/ai-assisted-api-gateway-optimization)[86. API Gateways for Low-Code and No-Code Integration: Governance and Safety](https://api7.ai/learning-center/api-gateway-guide/api-gateways-low-code-no-code-integration)[87. API Gateway and CIAM Integration: Token Validation, Consent, and Identity Context](https://api7.ai/learning-center/api-gateway-guide/api-gateway-ciam-integration)[88. Elastic API Gateway Scaling: Signals, Capacity, and Safe Scale-In](https://api7.ai/learning-center/api-gateway-guide/elastic-api-gateway-scaling)[89. Multi-Tenant SaaS API Gateways: Isolation, Quotas, and Tenant-Aware Policy](https://api7.ai/learning-center/api-gateway-guide/multi-tenant-saas-api-gateway-policy)[90. API Gateway DevSecOps: Policy as Code, Testing, and Runtime Feedback](https://api7.ai/learning-center/api-gateway-guide/api-gateway-devsecops)

10 Platform Engineering and Planning

[View this topic · 10](https://api7.ai/learning-center/api-gateway-guide?topic=platform-governance)[91. API Discovery and Documentation at the Gateway: Inventory, Ownership, and Drift](https://api7.ai/learning-center/api-gateway-guide/api-discovery-documentation-gateway)[92. WebAssembly Plugins for API Gateways: Portability, Isolation, and APISIX Boundaries](https://api7.ai/learning-center/api-gateway-guide/api-gateway-webassembly-plugins)[93. Monitoring API Gateways with Prometheus and Grafana: Metrics, Dashboards, and Alerts](https://api7.ai/learning-center/api-gateway-guide/monitor-api-gateways-prometheus-grafana)[94. API Gateway Reliability Engineering: SLOs, Failure Isolation, and Incident Response](https://api7.ai/learning-center/api-gateway-guide/api-gateway-reliability-engineering)[95. API Gateways for Edge AI Inference: Routing, Constraints, and Observability](https://api7.ai/learning-center/api-gateway-guide/api-gateways-edge-ai-inference)[96. Reducing Cloud Cost with API Gateway Controls: Measurement Before Optimization](https://api7.ai/learning-center/api-gateway-guide/reducing-cloud-cost-api-gateway-controls)[97. Improving API Developer Experience with Gateway Standards and Self-Service](https://api7.ai/learning-center/api-gateway-guide/improving-api-developer-experience-gateway-self-service)[98. API Gateway Change Management: Compatibility, Progressive Delivery, and Rollback](https://api7.ai/learning-center/api-gateway-guide/api-gateway-change-management-rollback)[99. Operating Serverless APIs: Cold Starts, Idempotency, and Asynchronous Handoffs](https://api7.ai/learning-center/api-gateway-guide/operating-serverless-apis-gateway)[100. Planning an API Gateway Roadmap for the Next Five Years](https://api7.ai/learning-center/api-gateway-guide/planning-api-gateway-roadmap-next-five-years)

[API Gateway Guide](https://api7.ai/learning-center/api-gateway-guide)[Gateway Ecosystem and Comparisons](https://api7.ai/learning-center/api-gateway-guide?topic=ecosystem)

On this page

On this page

- [Key Takeaways](#key-takeaways)

- [Distinguish the Components](#distinguish-the-components)

- [Choose a Deployment Pattern](#choose-a-deployment-pattern)

  - [1. Standalone Envoy at the edge](#1-standalone-envoy-at-the-edge)
  - [2. Envoy data plane with a gateway control plane](#2-envoy-data-plane-with-a-gateway-control-plane)
  - [3. Public API gateway before Envoy mesh proxies](#3-public-api-gateway-before-envoy-mesh-proxies)

- [Make Client-IP Handling Explicit](#make-client-ip-handling-explicit)

- [Keep Authorization Verdict and Enforcement Separate](#keep-authorization-verdict-and-enforcement-separate)

- [Design xDS Delivery as a Safety System](#design-xds-delivery-as-a-safety-system)

- [Assign Filters and Resilience Once](#assign-filters-and-resilience-once)

- [Preserve the Application Boundary](#preserve-the-application-boundary)

- [Verification Checklist](#verification-checklist)

- [Summary](#summary)

- [FAQ](#faq)

  - [Does Envoy require xDS?](#does-envoy-require-xds)
  - [Is Envoy Gateway the same as Envoy Proxy?](#is-envoy-gateway-the-same-as-envoy-proxy)
  - [Should `failure_mode_allow` be enabled?](#should-failure_mode_allow-be-enabled)

- [Next Steps](#next-steps)

Article 66

# API Gateway with Envoy: Deployment Patterns and Policy Ownership

API7.ai

September 14, 2026

Envoy can be the data plane of an API gateway, run as a standalone edge proxy, or participate in a service mesh. Those are different operating models. Envoy provides listeners, filters, clusters, routing, observability, and static or dynamic configuration; a gateway product or platform must still define who owns desired state, API consumers, policy, rollout, tenancy, and support.

Start by naming the product boundary. “We use Envoy” is not enough to tell an on-call engineer whether to edit a bootstrap file, a Kubernetes `HTTPRoute`, a vendor control plane, or a custom xDS service.

The raw Envoy behavior in this guide is reviewed against stable Envoy 1.39.1. Pin the deployed patch release; Envoy's floating `latest` documentation follows active development and is not used as evidence here.

## Key Takeaways

- Separate Envoy Proxy, Envoy Gateway, a service mesh, and third-party Envoy-based gateway products; they share technology but not one configuration or feature contract.
- Static configuration is valid for simple deployments. xDS adds dynamic configuration but also creates a control-plane API and consistency problem the platform must own.
- At an edge listener, `use_remote_address` and trusted XFF hops define client-IP semantics; the default path is not an end-user identity guarantee.
- In `ext_authz`, the authorization service returns a decision while Envoy enforces it. `failure_mode_allow` changes Envoy's behavior on service errors.
- Assign retries, timeouts, transformations, and authorization to one authoritative layer, then test filter order and failure timing.

## Distinguish the Components

| Component                       | What it owns                                                                            | What it does not automatically provide                               |
| ------------------------------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| Envoy Proxy                     | Network listeners, filter chains, routing, clusters, request processing                 | API product lifecycle, a human workflow, or a fleet control plane    |
| Custom xDS control plane        | Dynamic Envoy resources and rollout semantics defined by its implementer                | Correct API governance unless the platform builds it                 |
| Envoy Gateway                   | A Kubernetes Gateway API control plane that translates resources to xDS for Envoy Proxy | Equivalence with every Envoy-based commercial or open-source gateway |
| Service mesh using Envoy        | Mesh traffic policy and workload integration defined by that mesh                       | Public API consumer management by default                            |
| Envoy-based API gateway product | Product-specific policy, UI/API, tenancy, extensions, and support                       | Raw Envoy behavior without product-specific defaults and constraints |

The [Envoy 1.39.1 overview](https://www.envoyproxy.io/docs/envoy/v1.39.1/intro/what_is_envoy) describes a general L3/L4 and HTTP proxy with optional dynamic configuration. [Envoy Gateway](https://gateway.envoyproxy.io/docs/concepts/proxy/) is a separate project whose control plane translates Kubernetes Gateway API resources into xDS for Envoy Proxy. Evaluate the exact project and version instead of transferring capabilities between them.

## Choose a Deployment Pattern

### 1. Standalone Envoy at the edge

```
flowchart LR
    C[Client] --> E[Edge Envoy]
    E --> A[API service]
```

This is reasonable when a small team needs explicit proxy behavior and is prepared to own complete static configuration, delivery, certificates, filters, and rollback. Envoy 1.39.1's [xDS overview](https://www.envoyproxy.io/docs/envoy/v1.39.1/intro/arch_overview/operations/dynamic_configuration.html) confirms that fully static configuration is supported; Envoy does not require a dynamic control plane.

The trade-off is platform ownership. Static files do not create consumer onboarding, policy approval, distributed quota state, or safe multi-team tenancy. Build only the control surface the organization is willing to maintain.

### 2. Envoy data plane with a gateway control plane

```
flowchart LR
    O[Platform operator] --> P[Gateway control plane]
    P -->|xDS resources| E[Envoy data plane]
    C[Client] --> E
    E --> A[API service]
```

This pattern centralizes desired state and can update listeners, routes, clusters, endpoints, and secrets dynamically. The platform must define resource validation, ordering, rejection, rollout, rollback, and behavior during control-plane disconnection. The xDS APIs are a transport and resource model, not a complete change-management policy.

Record the last accepted configuration and expose rejected updates. Test a partial resource update, an invalid listener, a missing cluster, certificate rotation, and loss of the management server. Do not call a control-plane update successful only because its API accepted the request.

### 3. Public API gateway before Envoy mesh proxies

```
flowchart LR
    C[External client] --> G[API gateway]
    G --> W1[Service workload with Envoy]
    W1 --> W2[Downstream workload with Envoy]
```

Use this when the gateway owns the external API contract and Envoy-based mesh components own service traffic. Authenticate the gateway-to-workload connection, remove caller-supplied identity headers at the edge, and decide which verified context crosses the boundary. Avoid configuring the edge and mesh to retry or transform the same operation independently.

## Make Client-IP Handling Explicit

Envoy 1.39.1's [HTTP header documentation](https://www.envoyproxy.io/docs/envoy/v1.39.1/configuration/http/http_conn_man/headers) explains that `X-Forwarded-For` (XFF) can be forged by clients and that the immediately connected peer is the first reliable network fact. The `use_remote_address` Boolean and `xff_num_trusted_hops`, whose default is `0`, must be evaluated together:

- `use_remote_address: false` (default) and `xff_num_trusted_hops: 0`: when XFF is present, Envoy selects its rightmost address; when XFF is absent, Envoy uses the immediate downstream connection address.
- `use_remote_address: false` and `xff_num_trusted_hops: N` where `N > 0`: Envoy selects the `(N + 1)`th address from the right of XFF; if the list is too short, it falls back to the immediate downstream connection address.
- `use_remote_address: true` and `xff_num_trusted_hops: 0`: Envoy uses the immediate downstream connection address rather than XFF to select the trusted client address.
- `use_remote_address: true` and `xff_num_trusted_hops: N` where `N > 0`: Envoy selects the `N`th address from the right of XFF; if the list is too short, it falls back to the immediate downstream connection address.

The documentation generally recommends `use_remote_address: true` for a front proxy and may require `false` for an internal mesh proxy. Neither value is universally secure without topology. If the number of proxies changes, a hop-count rule can select the wrong address. Prefer a stable authenticated proxy path, restrict direct access, and test zero, expected, and extra-hop requests.

Envoy generates or mutates `x-request-id` according to edge and preservation settings. Use that value for correlation, not for authentication. If an external request ID is preserved, it remains caller-influenced unless an edge boundary replaces it.

## Keep Authorization Verdict and Enforcement Separate

Envoy 1.39.1's [`ext_authz` filter](https://www.envoyproxy.io/docs/envoy/v1.39.1/configuration/http/http_filters/ext_authz_filter) sends selected request context to an external authorization service. The service makes an allow or deny decision; Envoy applies the result in the request path. Filter order determines whether authentication metadata and transformations exist before the check and which later filters run after it.

This excerpt is intentionally incomplete and uses the Envoy 1.39.1 v3 API. It shows a fail-closed error path and must be integrated into a full listener and cluster configuration for that release:

```
http_filters:
  - name: envoy.filters.http.ext_authz
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
      grpc_service:
        envoy_grpc:
          cluster_name: authorization_service
        timeout: 0.5s
      failure_mode_allow: false
  - name: envoy.filters.http.router
    typed_config:
      "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
```

`failure_mode_allow` is a behavior-changing Boolean whose protobuf default is `false`:

- `false` (default): an authorization-service communication error or HTTP 5xx causes Envoy to reject the request.
- `true`: Envoy allows the request to continue on those service errors; metrics still record the event.

`failure_mode_allow_header_add` is a second behavior-changing Boolean and also defaults to `false`. When it is `false`, Envoy adds no fail-open marker. When it is `true`, Envoy adds `x-envoy-auth-failure-mode-allowed: true` only when `failure_mode_allow` is also `true` and the authorization-service communication fails or returns HTTP 5xx. Strip caller-supplied copies at the trusted edge, and do not treat this header alone as authoritative on a path that can bypass that edge.

These settings govern infrastructure errors, not an explicit deny decision. Choose `failure_mode_allow` for each `ext_authz` filter instance and its configuration scope, not as a per-route override: the versioned [`ExtAuthzPerRoute` API](https://www.envoyproxy.io/docs/envoy/v1.39.1/api-v3/extensions/filters/http/ext_authz/v3/ext_authz.proto) can disable the filter or provide check settings, but it does not override `failure_mode_allow`. Routes that require different error policies need separately scoped filter configurations. Make fail-open traffic observable, never label the authorization service's verdict as an Envoy operating mode, limit the body and headers sent to the service, protect credentials, and state whether a truncated or absent body can change the decision.

## Design xDS Delivery as a Safety System

Dynamic configuration adds several states: desired, delivered, accepted, rejected, and serving. Track them separately.

- Validate cross-resource references before rollout.
- Use staged cohorts rather than updating an entire fleet at once.
- Observe ACK/NACK and the exact resource version on each proxy.
- Keep certificates and secrets out of ordinary logs and diffs.
- Define whether rollback restores one resource or a coherent snapshot.
- Bound how long a proxy may serve stale state during control-plane loss.
- Rehearse recovery when the control plane returns with a newer but invalid configuration.

Aggregated xDS can improve ordering across resource types, but the platform still owns dependency correctness and rollout. A healthy control-plane API does not prove that every proxy accepted the same usable route graph.

## Assign Filters and Resilience Once

Envoy filter order is part of policy. Authentication must run before a policy that consumes authenticated claims. Header mutation before authorization can change what the policy sees; mutation after authorization can change what the upstream receives. Logging before a final transformation may record a different request from the one delivered.

For retries and timeouts, record:

- end-to-end and per-try deadlines;
- retryable status, reset, and connection conditions;
- method and operation safety;
- maximum attempts across client, gateway, mesh, and application;
- request-body buffering and streaming behavior;
- circuit-breaker and outlier-ejection interaction;
- cancellation propagation when the client leaves.

One Envoy layer may be the right owner, but multiple Envoy hops do not share an automatic global retry budget. Verify actual upstream attempts under reset, timeout, overload, and partial-response conditions.

## Preserve the Application Boundary

The gateway may authenticate a consumer and enforce route-level permission. It should not claim to complete object-level authorization unless it has the authoritative domain state. Forward the minimum verified context over an authenticated connection and let the service decide whether that principal may act on the requested account, order, or document.

Likewise, a successful external authorization decision describes the input and policy evaluated at that moment. It does not prove the upstream will interpret the path, method, or normalized headers identically. Test normalization and keep critical domain checks in the service.

## Verification Checklist

- The exact Envoy, Envoy Gateway, mesh, or gateway-product version and boundary are recorded.
- Only intended listeners and admin interfaces are reachable.
- Static or xDS configuration has a validated rollback artifact.
- XFF tests cover direct, expected-proxy, forged, and extra-hop paths.
- Missing, invalid, denied, auth-service-error, and allowed requests produce distinct observations.
- `failure_mode_allow` behavior matches the filter configuration scope's documented threat model.
- Filter order is tested using the actual transformed headers and identity metadata.
- Retry totals and deadlines remain bounded across every Envoy and non-Envoy hop.
- gRPC, streaming, WebSocket, large-body, and cancellation paths are exercised.
- Desired, delivered, accepted, and serving resource versions can be distinguished.

## Summary

Envoy is a capable proxy foundation, not one universal API gateway product. Choose whether configuration is static, owned by Envoy Gateway, delivered by a custom xDS control plane, or managed by another product. Then make the client-IP path, authorization verdict, fail-open or fail-closed behavior, filter order, retries, and application boundary explicit. The architecture is complete only when operators know which system to change and can prove which configuration each proxy is serving.

## FAQ

### Does Envoy require xDS?

No. Envoy supports static configuration. xDS is useful for dynamically managing a fleet, but its control plane and rollout behavior become platform responsibilities.

### Is Envoy Gateway the same as Envoy Proxy?

No. Envoy Proxy is the data-plane proxy. Envoy Gateway is a Kubernetes Gateway API control plane that configures Envoy Proxy.

### Should `failure_mode_allow` be enabled?

Only when the affected routes' availability and threat models justify allowing requests during authorization-service errors. The default is `false`; whichever path is chosen must be observable and tested. Routes that need different behavior require separately scoped filter configurations.

## Next Steps

Compare [Envoy and other gateway runtime families](https://api7.ai/learning-center/api-gateway-guide/nginx-vs-envoy-vs-java-vs-go), design [external authorization boundaries](https://api7.ai/learning-center/api-gateway-guide/fine-grained-api-gateway-authorization), and apply a [reproducible gateway benchmark method](https://api7.ai/learning-center/api-gateway-guide/traefik-kong-apisix-benchmark-method).

[Previous article**API Gateway with NGINX: Layering, Ownership, and Migration Patterns**](https://api7.ai/learning-center/api-gateway-guide/api-gateway-nginx)[Next article**API Gateway with Cloudflare API Shield: Edge and Origin Security Boundaries**](https://api7.ai/learning-center/api-gateway-guide/api-gateway-cloudflare-api-shield)

On this page

- [Key Takeaways](#key-takeaways)

- [Distinguish the Components](#distinguish-the-components)

- [Choose a Deployment Pattern](#choose-a-deployment-pattern)

  - [1. Standalone Envoy at the edge](#1-standalone-envoy-at-the-edge)
  - [2. Envoy data plane with a gateway control plane](#2-envoy-data-plane-with-a-gateway-control-plane)
  - [3. Public API gateway before Envoy mesh proxies](#3-public-api-gateway-before-envoy-mesh-proxies)

- [Make Client-IP Handling Explicit](#make-client-ip-handling-explicit)

- [Keep Authorization Verdict and Enforcement Separate](#keep-authorization-verdict-and-enforcement-separate)

- [Design xDS Delivery as a Safety System](#design-xds-delivery-as-a-safety-system)

- [Assign Filters and Resilience Once](#assign-filters-and-resilience-once)

- [Preserve the Application Boundary](#preserve-the-application-boundary)

- [Verification Checklist](#verification-checklist)

- [Summary](#summary)

- [FAQ](#faq)

  - [Does Envoy require xDS?](#does-envoy-require-xds)
  - [Is Envoy Gateway the same as Envoy Proxy?](#is-envoy-gateway-the-same-as-envoy-proxy)
  - [Should `failure_mode_allow` be enabled?](#should-failure_mode_allow-be-enabled)

- [Next Steps](#next-steps)
