spring-cloud / spring-cloud/spring-cloud-gateway

Support for excluding sub-paths in path-based routing predicates

Open
#3,784 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Is your feature request related to a problem? Please describe.
Hi team,

While configuring path-based routing, I noticed that there doesn't seem to be a built-in way to exclude specific paths from matching a route (e.g. applying a filter to /api/** but excluding /api/health).

Is there currently a recommended way to handle such exclusions within a route definition or filter configuration?
If not, would it be possible to consider supporting a feature that allows excluding certain sub-paths from a path predicate or filter?

If this feature is already planned or would be a welcome addition, I’d be happy to explore contributing a PR to help implement it.

Thanks!

Example (conceptual configuration):

- id: api
  uri: https://external-system
  predicates:
    - Path=/api/**
    - ExcludePath=/api/health  # hypothetical example

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by reviewing path-based routing predicates and filter configuration, using the conceptual YAML example as the starting point. Done means a route can match /api/** while excluding /api/health, with the supported configuration and resulting behavior verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.