Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StripPrefixGatewayFilter 404 #3215

Closed
yydzxz opened this issue Jan 13, 2024 · 9 comments
Closed

StripPrefixGatewayFilter 404 #3215

yydzxz opened this issue Jan 13, 2024 · 9 comments

Comments

@yydzxz
Copy link

yydzxz commented Jan 13, 2024

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-gateway/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.
image

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.
image

@kimmking
Copy link

where is the 404?

@yydzxz
Copy link
Author

yydzxz commented Jan 15, 2024

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.

@yydzxz yydzxz changed the title StripPrefixGatewayFiltr 404 StripPrefixGatewayFilter 404 Jan 15, 2024
@yydzxz
Copy link
Author

yydzxz commented Jan 16, 2024

image image

args is 3, but config.getParts() is 2

@mylxf
Copy link

mylxf commented Jan 25, 2024

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.

@yydzxz
Copy link
Author

yydzxz commented Jan 25, 2024

image image

bug code is line 177

@spencergibb
Copy link
Member

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.

@spring-cloud-issues
Copy link

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.

@spring-cloud-issues
Copy link

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.

@forgetmetoo
Copy link

image image
bug code is line 177

May I ask which version has fixed this issue? I also encountered the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants