• haproxy 规则匹配到了就停止,不会继续匹配下一个


          acl             url_web_wwm             path_beg                -i                      /scan
          use_backend    	zjtest7_com          if                                     url_web_wwm
    
    
            acl             url_static              path_end                .html .gif .png .jpg .css .js
            use_backend     api_zjtest7_com          if                      url_static
    
            
           backend zjtest7_com
           mode    	http
           server  	apphost_1		192.168.32.101:3000  	check inter 2000 fall 3
           
           backend api_zjtest7_com
           mode     http
           server   apphost_1               192.168.32.76:80     check inter 2000 fall 3
    
                  backend image_zjtest7_com
           mode     http
           server   apphost_1               192.168.32.61:80     check inter 2000 fall 3
    
    其中 zjtest7.com 和api.zjtest7.com 都指向到haproxy
    
    
    zjtest7-haproxy:/root# curl zjtest7.com/scan  此时发送到 zjtest7_com 而不会发送到 api_zjtest7_com 
    
    
    zjtest7-haproxy:/root# curl api.zjtest7.com/scan/index.html
    
    
    zjtest7-haproxy:/root# curl zjtest7.com/scan/test
    welcome wxpod999zjtest7-haproxy:/root# 
    
    
    
    /case 1*********************************
    
          acl             url_static              path_end                .html .gif .png .jpg .css .js
            use_backend     api_zjtest7_com          if                      url_static
          
          acl             url_web_wwm             path_beg                -i                      /scan
          use_backend    	zjtest7_com          if                                     url_web_wwm
    
    zjtest7-haproxy:/root# curl api.zjtest7.com/scan/index.html
    nginx01-192.168.32.76 20161218
    
    此时可以访问 因为先匹配到了 path_end ,没有继续往下匹配 不然 就会匹配scan 而无法访问
    
    
    /case 2***********************************
    
    
          acl             url_web_wwm             path_beg                -i                      /scan
          use_backend    	zjtest7_com          if                                     url_web_wwm
                acl             url_static              path_end                .html .gif .png .jpg .css .js
            use_backend     api_zjtest7_com          if                      url_static
    
    
    zjtest7-haproxy:/root# curl api.zjtest7.com/scan/index.html
    
    此时先匹配到了 /scan 没有继续往下 匹配  去访问zjtest7_com了 所以访问不到

  • 相关阅读:
    分治法求最大子序列
    6.2 链表 (UVa 11988, 12657)
    6.1 栈和队列 (UVa 210, 514, 442)
    S-Tree (UVa 712) 二叉树
    Equilibrium Mobile (UVa 12166) dfs二叉树
    Patrol Robot (UVa 1600) BFS
    Knight Moves (UVa 439) BFS
    Tree Recovery (UVa 536) 递归遍历二叉树
    Parentheses Balance (Uva 673) 栈
    Self-Assembly (UVa 1572)
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6198922.html
Copyright © 2020-2023  润新知