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

global retry filter leaves prefix path filter unapplied

Open
#571 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Sample configuration snippet:

spring.cloud.gateway.default-filters:
      default-filters:
      - name: Retry
        args:
          retries: 3
          statuses:
          - INTERNAL_SERVER_ERROR
          - GATEWAY_TIMEOUT
          exceptions:
          - java.io.IOException
          methods:
          - GET
          - HEAD
          - POST
          - PUT
          - PATCH
          - DELETE
          - OPTIONS
...
routes:
      - id: blah
        uri: blah
        predicates:
        - Path=/status/**
        filters:
        - PrefixPath=/v1

So, given /status to the gateway, the back-end receives /v1/status the first time, but /status on retries.

I am also reading at RouteDefinitionRouteLocator.java:181:
//TODO: support option to apply defaults after route specific filters?

Is there any chance this gets done soon? If not, what would be a more compact way to configure the same non-global retry filter on every route? I have over 60 routes and growing, so adding 15 lines of retry filter definition at every route is not a pleasant thing.

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

Reproduce the configuration using the global Retry filter, a Path predicate, and a PrefixPath filter. Start in RouteDefinitionRouteLocator.java around line 181 and trace how default and route-specific filters are ordered during retries. Done means the prefixed path remains applied on retry, or the supported compact configuration for applying the same retry behavior per route is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.