spring-boot - Zuul 路径 - SpringBoot 检测到它虽然没有配置
问题描述
我遵循了Spring Cloud 文档中的示例,现在已经在我的application.yml
server:
port: 18081
servlet:
context-path: /myPath/services
zuul:
# don't add per default all services automatically to the Zuul server
ignoredServices: '*'
routes:
mytest:
#path: /checkPath/**
url: http://mytest.server.local/api/
和一个配置的过滤器:
public class PreFilter extends ZuulFilter {
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 1;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest request = ctx.getRequest();
System.out.println("Request Method : " + request.getMethod() + " Request URL : " + request.getRequestURL().toString());
return null;
}
}
当我测试时
http://localhost:18081/myPath/services/mytest/test
我希望这仅在path
配置时才有效。如果我将其保留为上述(未注释),我会从 ZuulPreFilter 得到它被击中。我不会期望它,因为不应该找到路径。是否存在误解或我错过了配置中的某些内容?为什么路径完全被命中,因为.../checkPath2/...
不会被检测到?
解决方案
推荐阅读
- wordpress - 如果我们从 /var/www/html 中删除文件但不从 mysql 中删除数据库会发生什么
- ghostscript - 手动编码 Postscript 时,Ghostscript 会产生未定义的错误
- gensim - 如何在gensim“similar_by_vector”方法中控制距离度量
- python - 使用 python Selenium 解析数据时出现语法错误
- node.js - 获取 uuidv4 的最后 12 个字符
- java - 如何从 CosmosAsyncClient 获取 AsyncDocumentClient?
- python - subprocess.check_call 中的命令在我将它传递给 shlex.quote 之前不起作用
- android - 使用 compose 确定导航中是否位于 startDestination
- javascript - 只选择html表格的一部分
- hikvision - 配置对海康威视摄像机的访问