spring-cloud-gateway
spring-cloud-gateway copied to clipboard
StripPrefixGatewayFilter 404
Manifest-Version: 1.0 Implementation-Title: Spring Cloud Gateway Core Implementation-Version: 2.1.3.RELEASE Built-By: jenkins Implementation-Vendor-Id: org.springframework.cloud Created-By: Apache Maven 3.5.0 Build-Jdk: 1.8.0_201 Implementation-URL: https://spring.io/spring-cloud/spring-cloud-gatewa y/spring-cloud-gateway-core Implementation-Vendor: Pivotal Software, Inc.
I am currently encountering a 404 issue, and I haven't found any relevant information in the issues or on Stack Overflow. I would like to know if this problem has been fixed in the latest version. If it has been fixed, please provide the resolution method. Thank you very much. (Due to the involvement of too many services, upgrading the gateway version is currently not possible.)
To troubleshoot the issue, I added some logs in the source code. Below is the source code with the added logs.
The 2nd, 4th, and 6th lines in the log are all related to the route "saas-mini-application." From the log, it can be observed that in the 2nd line, the args are {parts=2}, but in the 4th line, the configuration is 3. However, from the code, it can be seen that the value of configuration comes from the args. This bug is not consistently reproducible and occurs with a very low probability. Therefore, I suspect it might be a concurrency issue. From the log, it can be seen that at this moment, there is another log entry for a different route, "saas-order-third-platform," and for this route, parts=3.
where is the 404?
where is the 404?
saas-order-platform, /api/order/platform/**, StripPrefix=3,
Under normal circumstances, when calling the URL http://gateway/api/order/thirdplatform/a/b, the request is directed to the path /a/b of the saas-order-platform service.
However, in some situations, the StripPrefix value has inexplicably changed to 2. In this case, when calling the URL http://gateway/api/order/thirdplatform/a/b, the request is directed to the path /thirdplatform/a/b of the saas-order-platform service, resulting in a 404 error.
args is 3, but config.getParts() is 2
Is there an official solution to this problem? We also encountered it. In cases of high concurrency, there may be routing path errors and StripPrefix={2} not taking effect.
bug code is line 177
In the future, please refrain from sharing text via images.
If you'd like us to spend some time investigating, please take the time to provide a complete, minimal, verifiable sample (something that we can unzip attached to this issue or git clone, build, and deploy) that reproduces the problem.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
![]()
bug code is line 177
May I ask which version has fixed this issue? I also encountered the same problem
bug code is line 177