Skip to content

Conversation

@ShivamJha2436
Copy link
Contributor

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
@github-actions
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

@github-actions
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
Contributor 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
@github-actions
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 Nov 17, 2025
@sunjayBhatia sunjayBhatia removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 17, 2025
Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just a tiny nit and we can merge this, thanks @ShivamJha2436 !

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>
@ShivamJha2436
Copy link
Contributor Author

Hey @sunjayBhatia I made the changes PTAL.

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.85%. Comparing base (9b28a35) to head (52d98eb).
⚠️ Report is 40 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7230      +/-   ##
==========================================
+ Coverage   81.05%   81.85%   +0.79%     
==========================================
  Files         130      130              
  Lines       19669    15747    -3922     
==========================================
- Hits        15943    12889    -3054     
+ Misses       3442     2574     -868     
  Partials      284      284              

see 125 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tsaarni tsaarni added the release-note/none-required Marks a PR as not requiring a release note. Should only be used for very small changes. label Nov 24, 2025
Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank You @ShivamJha2436!

@tsaarni tsaarni merged commit 6821e9b into projectcontour:main Nov 24, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/none-required Marks a PR as not requiring a release note. Should only be used for very small changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document how to do method matching in HTTPProxy

3 participants