天天看点

F5和nginx配合转发前端请求

第一步:

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配置文件中添加如下配置

                     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;

                     }

经过以上两步,配置完成,则调用关系为:

备注:

1,后端现在是nginx的反向代理,换成haproxy原理一样。

      本文转自Tenderrain 51CTO博客,原文链接:http://blog.51cto.com/tenderrain/1611368,如需转载请自行联系原作者

继续阅读