envoyproxy / gateway

Manages Envoy Proxy as a Standalone or Kubernetes-based Application Gateway
https://gateway.envoyproxy.io
Apache License 2.0
1.55k stars 333 forks source link

How to set `direct_response` (Return an arbitrary HTTP response directly, without proxying) #4346

Closed yuyicai closed 1 day ago

yuyicai commented 1 day ago

Description: How to set direct_response using envoy gateway? The envoy proxy native configuration:

route_config:
  virtual_hosts:
    - name: direct
      domains:
        - "www.example.com"
      routes:
        - match:
            prefix: "/404"
          direct_response: 
            status: 404

[optional Relevant Links:] https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-field-config-route-v3-route-direct-response

https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-msg-config-route-v3-directresponseaction

arkodg commented 1 day ago

dup of https://github.com/envoyproxy/gateway/issues/2714 the work is in progress https://github.com/envoyproxy/gateway/pull/4334 and should hopefully land in v1.2 (end Oct 2024)