alibaba / Sentinel

A powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件)
https://sentinelguard.io/
Apache License 2.0
22.18k stars 7.96k forks source link

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

Open boengood opened 2 years ago

boengood commented 2 years ago

Issue Description

通过 Route ID 设置了 降级后,在gatewayFilter 通过dubbo调用 鉴权服务,鉴权服务返回错误后,首次通过接口调用返回状态 500 是正常,但降级后,返回状态是 200 ,字符为空

错误信息,但拦截错误,设置了返回状态也无用: 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

  <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-gateway</artifactId>
        <version>2.2.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
        <version>2.2.5.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
        <version>2.2.5.RELEASE</version>
    </dependency>

Anything else we need to know?

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

boengood commented 2 years ago

简单说,就是配置了限流后,如果没有进入spring boot 服务,直接gateway 返回了,就会导致 返回为空的问题

kiritoowo commented 2 years ago

有解决方案了嘛?