shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

[BUG] <After upgrading to v2.6.0, the contextpath plugin "addPrefix" function is incompatible, and a temporary solution.>

Open lianjunwei opened this issue 11 months ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

Request api through shenyu gateway: http://127.0.0.1:9195/http-swagger2/post/hi. When the shenyu gateway enables the contextpath plug-in, the shenyu gateway will delete the path prefix "/http-swagger2" by default and forward it to the backend microservice. image

If you want the gateway to forward the backend service, add "/http-swagger2" prefix, there are 2 solutions: a. Set "addPrefixed" as open. b. Or configure as shown in the screenshot below: image

But after upgrading to v2.6.0, the original configuration becomes invalid.

Expected Behavior

After upgrading to v2.6.0, when the switch of addprefixed is turned on, or when addPrefix is filled in, the 404 error cannot be thrown.

Steps To Reproduce

image Code removed by optimization should be added back.

Environment

ShenYu version(s): 2.6.0

Debug logs

No response

Anything else?

Before the fix, if you had the gateway forward to backend microservices keep the contextpath prefix. There are 2 solutions.

The first fix solution: Please do not fill in values for these two parameters (if any, delete them). As shown in the screenshot below: image

The first fix solution: The second fix solution: rewrite the url through the rewrite plug-in.

lianjunwei avatar Aug 20 '23 10:08 lianjunwei