HAProxy 的acl應用

很是好的博文推薦:http://blog.51cto.com/1992tao/1875563php

官方文檔:https://cbonte.github.io/haproxy-dconv/1.9/configuration.html#blockhtml

hdr([<name>[,<occ>]]) : string                 ACL derivatives :
這將提取請求的URL路徑,該路徑從第一條斜槓開始。                 hdr([<name>[,<occ>]])     : exact string match    hdr_reg(host) 匹配www.baidu.com的內容
在問號以前結束(沒有主機部分)。一個典型的用法是                 hdr_beg([<name>[,<occ>]]) : prefix match          hdr_reg(user-agent)匹配請求報文中的瀏覽器
可預取的高速緩存和須要聚合的多個門戶                                 hdr_dir([<name>[,<occ>]]) : subdir match           acl missing_cl hdr_cnt(Content-length) eq 0
數據庫中的信息,並將它們保存在緩存中。注意外出時                 hdr_dom([<name>[,<occ>]]) : domain match      #當請求的header中Content-length 等於0時返回true
緩存,更明智的是使用「URL」來代替。用ACL,它一般是               hdr_end([<name>[,<occ>]]) : suffix match         
用於匹配精確的文件名(例如「/Logial.php」)或目錄部分使用        hdr_len([<name>[,<occ>]]) : length match         
派生形式。還能夠看到「URL」和「BASE」獲取方法。                     hdr_reg([<name>[,<occ>]]) : regex match          
                                                                               hdr_sub([<name>[,<occ>]]) : substring match      
path : string                                            ACL derivatives :                                 
這將提取請求的URL路徑,該路徑從第一條斜槓開始。                 path     : exact string match              只匹配www.baidu.com/blog/lbb/index.html中
在問號以前結束(沒有主機部分)。一個典型的用法是                 path_beg : prefix match                    的/blog/lbb/index.html這部分URl
可預取的高速緩存和須要聚合的多個門戶                                 path_dir : subdir match            
數據庫中的信息,並將它們保存在緩存中。注意外出時                 path_dom : domain match            
緩存,更明智的是使用「URL」來代替。用ACL,它一般是               path_end : suffix match            
用於匹配精確的文件名(例如「/Logial.php」)或目錄部分使用        path_len : length match            
派生形式。還能夠看到「URL」和「BASE」獲取方法。                     path_reg : regex match             
                                                                         path_sub : substring match         
url : string                                              ACL derivatives :
這將提取請求中呈現的請求的URL。一個典型的用法是                  url     : exact string match               匹配www.baidu.com/blog/lbb/index.html中
具備預取能力的緩存,以及須要聚合的門戶。                            url_beg : prefix match                     的所有內容
數據庫中的多個信息,並將它們保存在緩存中。使用ACL,使用       url_dir : subdir match             
「路徑」優於使用「URL」,由於客戶端能夠發送完整的URL做爲          url_dom : domain match             
一般是用代理完成的。惟一真正的用途是匹配「*」。                     url_end : suffix match             
在「路徑」中不匹配,而且已經存在預約義的ACL。見                    url_len : length match             
「路徑」和「基礎」。                                                          url_reg : regex match              
redirect prefix <pfx> [code <code>] <option> \
[{if | unless} <condition>     url_sub : substring match
<代碼>代碼是可選的。它指示HTTP重定向的類型。              method http方法:
是須要的。僅支持代碼301, 302, 30三、307和308,                   req_ver  請求版本
若是沒有指定代碼,則默認使用302。301手段                           resp_ver  響應版本
「永久移動」,瀏覽器能夠緩存位置。三百零二                             status   http狀態
意味着「臨時移動」,意味着瀏覽器不該該                                  url    精確匹配url
緩存重定向。303等於302,除了                                           url_reg  正則匹配
瀏覽器將獲取一個get方法的位置。307只是                              url_dir   斜線之間
如302,但清楚地代表,一樣的方法必須重複使用。                      url_dom   斜線之間或點之間
一樣地,若是必須使用相同的方法,則308替換301。   git

相關文章
相關標籤/搜索