envoyproxy/envoy

Support request header match for custom response filter

已關閉

#45,713 建立於 2026年6月19日

 (3 則留言) (0 個反應) (0 位負責人)C++ (5,373 個分叉)batch import
area/custom_responseenhancementhelp wanted

倉庫指標

星標
 (27,997 顆星)
PR 合併指標
 (平均合併 8天) (30 天內合併 378 個 PR)

描述

Title: Support request header match for custom response filter

Description:

The use case for this feature request is to send either an HTML or JSON content-type error page, depending on the Accept request header sent by the client.

We used this in other proxies like Apache HTTPD and Nginx and would allow us to migrate to envoy proxy resp. envoy gateway - https://github.com/envoyproxy/gateway/issues/8608

The custom response http filter allows matching on response status, response headers, and more.

What is missing is the ability to match on request headers. The documentation is not clear on this, but the code clearly states that this is not supported: https://github.com/envoyproxy/envoy/blob/231c51dae4623efa72489741cbe1a2db0c85a683/source/extensions/filters/http/custom_response/custom_response_filter.cc#L23-L25

There are other ways to work around the issue. Such as having different route matches based on this header, which means you need to double the number of routes. Alternatively, you can take the detour via header-to-metadata and implement a quick hack.

Having a clean support for also matching against request headers would be preferred.

貢獻者指南