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

route degrade bug

Open
#3,750 3 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

Describe the bug
Please provide details of the problem, including the version of Spring Cloud that you
are using.

i wan't degrade to another route when invoke error with specify http code

Sample
If possible, please provide a test case or sample application that reproduces
the problem. This makes it much easier for us to diagnose the problem and to verify that
we have fixed it.

  - id: gpt-4o
      metadata:
        name: gpt-4o
      uri: https://xxx-xxx-2.xxx-api.xxx
      predicates:
        - Path=/gpt-4o/api/v1/**
        - Weight=gpt-4o, 1
      filters:
        - RewritePath=/gpt-4o/api/v1/(?<segment>.*), /deployments/gpt-4o/${segment}
        - RemoveRequestHeader=Authorization
        - AddRequestHeader=Ocp-Apim-Subscription-Key, xxx
        - name: ModifyRequestBody
          args:
            inClass: java.lang.String
            outClass: java.lang.String
            rewriteFunction: com.ximalaya.infra.deepgate.filters.rewrite.RequestTransformer
            contentType: application/json
    - id: gpt-4o-xxx
      metadata:
        name: gpt-4o
        connect-timeout: 60000
      uri: https://xxx.xxx.com
      predicates:
        - Path=/xxx/api/v1/**
      filters:
        - RewritePath=/xxx/api/v1/(?<segment>.*), /test/v1/ai/xxx
        - RemoveRequestHeader=Authorization
        - AddRequestHeader=Authorization, Bearer xxx
        - name: ModifyRequestBody
          args:
            inClass: java.lang.String
            outClass: java.lang.String
            rewriteFunction: com.ximalaya.infra.deepgate.filters.rewrite.RequestTransformer
            contentType: application/json
        - name: CircuitBreaker
          args:
            name: gpt4oCircuitBreaker
            fallbackUri: forward:/gpt-4o
            statusCodes:
              - 401
              - 403
              - 404
              - 408
              - 502
              - 503
              - 504

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

Use the supplied Spring Cloud Gateway route configuration as the reproduction case, focusing on the CircuitBreaker fallbackUri and listed statusCodes. Trigger one of the specified HTTP errors and verify whether forwarding to /gpt-4o selects the alternate route; completion should demonstrate the expected degradation behavior or clearly isolate the failing condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.