Skip to content

Conversation

ShivamJha2436
Copy link

Overview

This PR adds documentation for HTTP method-based routing in HTTPProxy objects using Envoy pseudo-headers (:method). While Contour supports routing based on path, headers, and query parameters, method matching was not clearly documented. This update provides guidance for users who want to route requests based on HTTP methods such as GET, POST, PUT, etc.

What was changed

  • Added a Method Matching section under Route Conditions in request-routing.md.
  • Included a YAML example demonstrating routing GET and POST requests to different backend services.
  • Explained how to use Envoy pseudo-header :method with header conditions to implement method-based routing.
  • Positioned the new section logically after Header Conditions so users can understand it in the context of existing routing options.

Why this change is needed

  • Existing documentation does not cover method matching in HTTPProxy, even though it is supported via Envoy pseudo-headers.
  • Users currently may be unaware of how to implement method-based routing.
  • Improves Contour documentation completeness and user experience.

Example

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: method-routing
  namespace: default
spec:
  virtualhost:
    fqdn: example.bar.com
  routes:
    - conditions:
        - header:
            name: ":method"
            exact: GET
      services:
        - name: get-service
          port: 80
    - conditions:
        - header:
            name: ":method"
            exact: POST
      services:
        - name: post-service
          port: 80

This example demonstrates routing GET requests to get-service and POST requests to post-service.

Related Issue

Closes #5753 - Document how to do method matching in HTTPProxy

@ShivamJha2436 ShivamJha2436 requested a review from a team as a code owner September 16, 2025 13:21
@ShivamJha2436 ShivamJha2436 requested review from tsaarni and sunjayBhatia and removed request for a team September 16, 2025 13:21
@sunjayBhatia sunjayBhatia requested review from a team, rajatvig and izturn and removed request for a team September 16, 2025 13:21
Copy link

Hi @ShivamJha2436! Welcome to our community and thank you for opening your first Pull Request. Someone will review it soon. Thank you for committing to making Contour better. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to do method matching in HTTPProxy
1 participant