alibaba / alibaba/Sentinel

gateway 进行Dubbo 调用,设置了Route 降级,降级后返回httpstatus 为 200 ,内容为空,而不是设置的返回状态,调整多个设置都无用

Open
#2,335 2 comments 0 reactions 0 assignees View on GitHub
area/gateway-flow-control
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## Issue Description
通过 Route ID 设置了 降级后,在gatewayFilter 通过dubbo调用 鉴权服务,鉴权服务返回错误后,首次通过接口调用返回状态 500 是正常,但降级后,**返回状态是 200 ,字符为空**,
- filter 设置了 Mono 返回 也无效
- 在 ErrorWebExceptionHandler 获取到了 ParamFlowException ,按照 [这篇文章的](https://github.com/alibaba/Sentinel/issues/2049),设置了自定义返回 Mono 也无效,依然改变了我设置的返回状态和内容
- 未进入 BlockRequestHandler

错误信息,但拦截错误,设置了返回状态也无用:
com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowException: $D
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ springfox.boot.starter.autoconfigure.SwaggerUiWebFluxConfiguration$CustomWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.web.cors.reactive.CorsWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ HTTP GET "/demo/dubbo/echo" [ExceptionHandlingWebHandler]
Stack trace:

### Tell us your environment

org.springframework.cloud
spring-cloud-starter-gateway
2.2.3.RELEASE


com.alibaba.cloud
spring-cloud-starter-alibaba-sentinel
2.2.5.RELEASE


com.alibaba.cloud
spring-cloud-alibaba-sentinel-gateway
2.2.5.RELEASE

### Anything else we need to know?
如何设置,才能返回我设置的状态 和 内容?或者还有其他解决方案吗?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Route ID downgrade on /demo/dubbo/echo with the listed Spring Cloud Gateway and Sentinel dependencies. Inspect the gatewayFilter, ErrorWebExceptionHandler, and BlockRequestHandler behavior around ParamFlowException; done means the configured HTTP status and response content remain after downgrade.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.