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

Signed-off-by: Shivam Kumar <shivamkumar87148@gmail.com>
@ShivamJha2436 ShivamJha2436 requested a review from a team as a code owner September 16, 2025 13:21
@ShivamJha2436 ShivamJha2436 requested review from sunjayBhatia and tsaarni and removed request for a team September 16, 2025 13:21
@sunjayBhatia sunjayBhatia requested review from a team, izturn and rajatvig 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

Copy link

The Contour project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 30d of inactivity, lifecycle/stale is applied
  • After 60d of inactivity since lifecycle/stale was applied, the PR is closed

You can:

  • Ensure your PR is passing all CI checks. PRs that are fully green are more likely to be reviewed. If you are having trouble with CI checks, reach out to the #contour channel in the Kubernetes Slack workspace.
  • Mark this PR as fresh by commenting or pushing a commit
  • Close this PR
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 17, 2025
@ShivamJha2436
Copy link
Author

/keep

@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 18, 2025
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