This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new a2a9ac905 optimize LocalDispatcherFilter (#3246)
a2a9ac905 is described below

commit a2a9ac905a60c8dfacf8631b5b337fd0e3268eee
Author: dragon-zhang <[email protected]>
AuthorDate: Thu Apr 14 22:44:08 2022 +0800

    optimize LocalDispatcherFilter (#3246)
---
 .../java/org/apache/shenyu/web/filter/LocalDispatcherFilter.java     | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/shenyu-web/src/main/java/org/apache/shenyu/web/filter/LocalDispatcherFilter.java
 
b/shenyu-web/src/main/java/org/apache/shenyu/web/filter/LocalDispatcherFilter.java
index 2acfbbdc8..02bc9958b 100644
--- 
a/shenyu-web/src/main/java/org/apache/shenyu/web/filter/LocalDispatcherFilter.java
+++ 
b/shenyu-web/src/main/java/org/apache/shenyu/web/filter/LocalDispatcherFilter.java
@@ -18,7 +18,6 @@
 package org.apache.shenyu.web.filter;
 
 import org.apache.shenyu.common.constant.Constants;
-import org.apache.shenyu.common.utils.PathMatchUtils;
 import org.apache.shenyu.common.utils.ShaUtils;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.reactive.DispatcherHandler;
@@ -36,7 +35,7 @@ import java.util.Objects;
  */
 public class LocalDispatcherFilter implements WebFilter {
     
-    private static final String DISPATCHER_PATH = "/shenyu/**";
+    private static final String DISPATCHER_PATH = "/shenyu/";
 
     private final DispatcherHandler dispatcherHandler;
     
@@ -65,7 +64,7 @@ public class LocalDispatcherFilter implements WebFilter {
     @Nonnull
     public Mono<Void> filter(@Nonnull final ServerWebExchange exchange, 
@Nonnull final WebFilterChain chain) {
         String path = exchange.getRequest().getURI().getPath();
-        if (PathMatchUtils.match(DISPATCHER_PATH, path)) {
+        if (path.startsWith(DISPATCHER_PATH)) {
             String localKey = 
exchange.getRequest().getHeaders().getFirst(Constants.LOCAL_KEY);
             if (Objects.isNull(sha512Key) || 
!sha512Key.equalsIgnoreCase(ShaUtils.shaEncryption(localKey)) || 
Objects.isNull(localKey)) {
                 return Mono.error(new 
ResponseStatusException(HttpStatus.FORBIDDEN, "The key is not correct."));

Reply via email to