refactor(gateway): Centralize ignored URL configuration

This commit is contained in:
2025-04-14 16:18:46 +08:00
parent 7c9513cf1e
commit 66477b708f
2 changed files with 11 additions and 21 deletions
@@ -41,7 +41,7 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
@Value("${jwt.token-header:Authorization}") @Value("${jwt.token-header:Authorization}")
private String tokenHeader; private String tokenHeader;
@Value("${spring.cloud.gateway.ignore.urls}") @Value("${gateway.ignore.urls:/**/auth/login,/**/auth/register,/**/auth/captcha,/content/video/public/**,/content/category/tree,/content/category/list,/comment/reply/public/**,/comment/public/**,/admin/auth/captcha,/admin/auth/login}")
private List<String> ignoreUrls; private List<String> ignoreUrls;
private final AntPathMatcher pathMatcher = new AntPathMatcher(); private final AntPathMatcher pathMatcher = new AntPathMatcher();
@@ -25,18 +25,6 @@ spring:
group: ${NACOS_GROUP:DEFAULT_GROUP} group: ${NACOS_GROUP:DEFAULT_GROUP}
refresh: true refresh: true
gateway: gateway:
ignore:
urls:
- /**/auth/login
- /**/auth/register
- /**/auth/captcha
- /content/video/public/**
- /content/category/tree
- /content/category/list
- /comment/reply/public/**
- /comment/public/**
- /admin/auth/captcha
- /admin/auth/login
discovery: discovery:
locator: locator:
enabled: true enabled: true
@@ -97,11 +85,13 @@ management:
gateway: gateway:
ignore: ignore:
urls: urls:
- /auth/login - /**/auth/login
- /auth/register - /**/auth/register
- /auth/captcha - /**/auth/captcha
- /*/v3/api-docs - /content/video/public/**
- /swagger-resources/** - /content/category/tree
- /swagger-ui/** - /content/category/list
- /actuator/** - /comment/reply/public/**
- /favicon.ico - /comment/public/**
- /admin/auth/captcha
- /admin/auth/login