断言Route Predicate Factory
2023-04-19 22:09:40 0 举报
AI智能生成
Gateway断言列表,网关Gateway提供了很多针对HTTP请求的断言工厂
作者其他创作
大纲/内容
<span style="font-size: inherit;">ZonedDateTime</span><br>
BeforeRoutePredicateFactory
Before 的参数为日期时间,<br>在指定日期时间之前发生的请求才能断言成功<br>
AfterRoutePredicateFactory
After 的参数为日期时间,<br>在指定日期时间之后发生的请求才能断言成功<br>
BetweenRoutePredicateFactory
Between 的参数为日期时间,<br>在指定日期时间之间发生的请求才能断言成功<br>
Cookie
CookieRoutePredicateFactory
Cookie 的两个参数为 cookie <b style=""><font color="#e74f4c">名称</font></b>和<b><font color="#e74f4c">正则表达式</font></b>。<br> 匹配具有给定名称且其值与正则表达式匹配的 Cookie<br>
Header
HeaderRoutePredicateFactory
Header 的两个参数为 Header <b><font color="#e74f4c">名称</font></b>和<b><font color="#e74f4c">正则表达式</font></b>。<br> 匹配具有给定名称且其值与正则表达式匹配的 Header<br>
CloudFoundryRouteServiceRoutePredicateFactory
匹配包含特殊请求头
Host
HostRoutePredicateFactory
Host 用来匹配当前请求的 host 规则,该参数一般为自动计算,不需要手动设置,<br>只有当前请求头中的Host满足 gateway 所设定支持的Host规则时,断言才会放行请求<br>
Method
MethodRoutePredicateFactory
Method用来指定gateway断言支持的请求方式,如:<font color="#e74f4c"><b>GET</b></font>、<font color="#e74f4c"><b>POST</b></font>或是<font color="#e74f4c"><b>PUT</b></font>等,<br>有请求方式在gateway所设定支持请求方式范围内断言才通过<br>
Path
PathRoutePredicateFactory
gateway所支持的路由接口地址,其中 <b><font color="#e74f4c">**</font></b> 代表任何级别的接口名,<br><b><font color="#e74f4c">{}</font></b> 代表只能匹配一层路径,多则不能匹配
Query
QueryRoutePredicateFactory
Query 用来指定请求的两个参数:<b><font color="#e74f4c">必需参数(参数名)</font></b>和<font color="#e74f4c" style=""><b>可选参数(参数值)</b></font>,<br>并且传递的查询参数必须与 gateway 所指定的完全相同,否则断言拒绝当前请求<br>
RemoteAddr
RemoteAddrRoutePredicateFactory
RemoteAddr用来设定断言所支持的IP网段,<br>格式:<b><font color="#e74f4c">IP地址/子网掩码</font></b>,如果当前请求的IP地址在RemoteAddr所指定的IP段内,<br>则gateway断言放行该请求<br>
RemoteAddr
WeightRoutePredicateFactory
Weight是用来指定当前请求被路由的权重的,其接收两个参数:<font color="#e74f4c"><b>分组</b></font>和<font color="#e74f4c"><b>比重</b></font>,<br>参与权重路由的地址必须在<b><font color="#e74f4c">同一个分组</font></b>,否则 weight 无效果,而权重为<font color="#e74f4c"><b>整型数字</b></font><br>
收藏
0 条评论
下一页