第一步:
F5上配置irules匹配规则(在Definition中填写 ),内容如下:
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/exinterface111/*"
{
pool pool_name1
}
"/order/interface/export*"
{
pool pool_name2
}
"/order/interface/update*"
{
pool pool_name3
}
}
}
第二步:
然后在pool_name1后端对应的服务器的nginx配置文件中添加如下配置
location = /exinterface111/post/policies-test/postlog/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $http_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_pass http://192.168.*.*:9065;
}
经过以上两步,配置完成,则调用关系为:
访问:http://域名//exinterface111/**/**/**(以exinterface111这个开头的URI)都会转到F5,F5经过irule匹配规则转发到后端pool_name1对应的server,然后server在nginx配置文件中匹配到了对应的location(比如/exinterface111/post/policies-test/postlog/),就把请求proxy_pass转发到了http://192.168.*.*:9065
备注:
1,后端现在是nginx的反向代理,换成haproxy原理一样。
转载于:https://blog.51cto.com/tenderrain/1611368