envoyproxy/envoy

Custom data input types blocked by RouteActionValidationVisitor in route matchers

Open

#41,180 创建于 2025年9月23日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)C++ (5,373 fork)batch import
area/matchinghelp wanted

仓库指标

Star
 (27,997 star)
PR 合并指标
 (平均合并 8天) (30 天内合并 378 个 PR)

描述

Background

I want to use matcher_tree and matcher_list in route matching to match based on query parameters, but custom data input types are blocked by RouteActionValidationVisitor.

The RouteActionValidationVisitor::performDataInputValidation in source/common/router/matcher_visitor.cc only allows:

  • HttpRequestHeaderMatchInput
  • FilterStateInput

https://github.com/envoyproxy/envoy/blob/main/source/common/router/matcher_visitor.cc

absl::Status RouteActionValidationVisitor::performDataInputValidation(
    const Matcher::DataInputFactory<Http::HttpMatchingData>&, absl::string_view type_url) {
  static const std::string request_header_input_name = TypeUtil::descriptorFullNameToTypeUrl(
      createReflectableMessage(
          envoy::type::matcher::v3::HttpRequestHeaderMatchInput::default_instance())
          ->GetDescriptor()
          ->full_name());
  static const std::string filter_state_input_name = TypeUtil::descriptorFullNameToTypeUrl(
      createReflectableMessage(envoy::extensions::matching::common_inputs::network::v3::
                                   FilterStateInput::default_instance())
          ->GetDescriptor()
          ->full_name());
  if (type_url == request_header_input_name || type_url == filter_state_input_name) {
    return absl::OkStatus();
  }

  return absl::InvalidArgumentError(
      fmt::format("Route table can only match on request headers, saw {}", type_url));
}

Questions

  1. Why is this restriction in place? What's the design rationale?
  2. Is there a recommended way to do query parameter matching in route matchers?
  3. Are there plans to support more data input types in route matchers?

贡献者指南