Spring cloud Spring云网关uri解码失败

Spring cloud Spring云网关uri解码失败,spring-cloud,Spring Cloud,我使用SpringCloudGreenwich二进制文件编写了一个网关应用程序。当URL中出现特殊字符时,我看到了一些问题。当请求URI包含特殊字符时,请求失败,Spring网关中出现以下异常 localhost:8080/myresource/WG\u splchar\u26%5E%26%25%5E%26%23%25%24%5E%26%25%26*%25%2B)!%24%23%24%25%26%5E_新 当我点击上面的url时,Spring失败,出现下面的异常。我无法理解为什么这是一个无效的序

我使用SpringCloudGreenwich二进制文件编写了一个网关应用程序。当URL中出现特殊字符时,我看到了一些问题。当请求URI包含特殊字符时,请求失败,Spring网关中出现以下异常

localhost:8080/myresource/WG\u splchar\u26%5E%26%25%5E%26%23%25%24%5E%26%25%26*%25%2B)!%24%23%24%25%26%5E_新

当我点击上面的url时,Spring失败,出现下面的异常。我无法理解为什么这是一个无效的序列,以及如何处理这些事情

 java.lang.IllegalArgumentException: Invalid encoded sequence "%^&#%$^&%&*%+)!$#$%&^_new"
at org.springframework.util.StringUtils.uriDecode(StringUtils.java:741) ~[spring-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.http.server.DefaultPathContainer.parsePathSegment(DefaultPathContainer.java:126) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.http.server.DefaultPathContainer.createFromUrlPath(DefaultPathContainer.java:111) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.http.server.PathContainer.parsePath(PathContainer.java:76) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.cloud.gateway.handler.predicate.PathRoutePredicateFactory.lambda$apply$2(PathRoutePredicateFactory.java:79) ~[spring-cloud-gateway-core-2.1.0.RC3.jar:2.1.0.RC3]
at org.springframework.cloud.gateway.support.ServerWebExchangeUtils.lambda$toAsyncPredicate$1(ServerWebExchangeUtils.java:128) ~[spring-cloud-gateway-core-2.1.0.RC3.jar:2.1.0.RC3]
at org.springframework.cloud.gateway.handler.AsyncPredicate.lambda$and$1(AsyncPredicate.java:35) ~[spring-cloud-gateway-core-2.1.0.RC3.jar:2.1.0.RC3]
at org.springframework.cloud.gateway.handler.RoutePredicateHandlerMapping.lambda$null$2(RoutePredicateHandlerMapping.java:112) ~[spring-cloud-gateway-core-2.1.0.RC3.jar:2.1.0.RC3]
at reactor.core.publisher.MonoFilterWhen$MonoFilterWhenMain.onNext(MonoFilterWhen.java:116) [reactor-core-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2070) [reactor-core-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at reactor.core.publisher.MonoFilterWhen$MonoFilterWhenMain.onSubscribe(MonoFilterWhen.java:103) [reactor-core-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:54) [reactor-core-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at reactor.core.publisher.MonoFilterWhen.subscribe(MonoFilterWhen.java:56) [reactor-core-3.2.5.RELEASE.jar:3.2.5.RELEASE]

我已经回答了另一个问题,不想再打字了。答案的精神是完全相同的

在SpringCloud utils中编写一个单元测试来执行此方法。这就是破坏的东西。你可以试着把你关心的绳子或多或少地传进去,找到断裂的地方。使用二进制搜索找出损坏的内容。确保不要在编码字符中间拆分字符串,否则你会给自己一个假阳性。当它说您有一个无效序列时,我希望您有像%99这样的东西,其中99没有映射到任何有效字符(我只是编了一个)

旁白 这个编码字符串来自哪里?你们公司有人创建了他们自己的解决方案来编码这个字符串吗?您是否接受用户数据?很有可能是谁负责生成这个字符串,并通过自己的编码器对其进行了错误编码

或者
spring.cloud.gateway.routes[7]。谓词[0]=Path=/test/{testId}/test1/test\uu%26%5E%26%25%5E%26%25%26*%25%2B)

当我看这个时,我看到一条已经编码的路径。例如,您已将您的符号和字符替换为%26

您是否尝试输入尚未编码的路径

比如说
spring.cloud.gateway.routes[7]。谓词[0]=Path=/test/{testId}/test1/test&&^&%^
为什么您使用的是SpringCloud(RC3)的候选版本,而不是版本或服务版本(SR1)。这是重复的吗?对让我们把那个标记为dupe。谢谢你的帮助。让我试试这些,但这看起来很有希望。我会投别人的票。