ATS中的ComboHandler合并回源插件调研
生活随笔
收集整理的這篇文章主要介紹了
ATS中的ComboHandler合并回源插件调研
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
介紹
該插件提供了一種智能方式來將多個URL復(fù)合為一個URL,從而將原來的多個響應(yīng)合并為一個單一的響應(yīng)。這非常有用,比如說,將多個CSS或js文件合并為一個文件。
目前git中的最新源碼已經(jīng)將comboHandler的內(nèi)容移到plugins/experimental/esi目錄下面了。目前的最新版本是1.2.0
安裝
在configure時(shí)指定
--enable-experimental-plugins
在build時(shí)會生成該庫comboo_handler.so。注意該插件需要和ESI模塊結(jié)合來build和installed,因?yàn)樗鼈児蚕韈ommon code
配置
在plugin.config中依次給出下面的參數(shù)
1).trigger combo handler的path,默認(rèn)是"admin/v1/combo"
2).用于認(rèn)證簽名signature verification的key名稱,默認(rèn)是disabled,驗(yàn)證還未實(shí)現(xiàn)
3).colon分隔的header列表,假如至少存在一個響應(yīng),也會被添加到combo response中
如果這些參數(shù)中任何一個寫-,則表示將采用默認(rèn)值,從而該插件的配置項(xiàng)將是
combo_handler.so - - -
像original combohandler一樣, 該插件生成形如
http://localhost/<dir>/<file-path>
的url,這里<dir>默認(rèn)是"Host" header,除非query parameter中的file path部分使用冒號指定:
http://combo.com/admin/v1/combo?filepath1&dir1:filepath2&filepath3
這會得到下面的3個網(wǎng)頁
http://localhost/combo.com/filepath1
http://localhost/dir1/filepath2
http://localhost/combo.com/filepath3
上面的url需要在remap規(guī)則中指定要map到的content servers
配置示例
[plugin.config]
combo_handler.so admin/v1/combo
[remap.config]
map http://combo.com ? ? ? ? ? ? http://os.combo.com ?@plugin=combo_handler.so
map http://localhost/combo.com ? http://os.combo.com
map http://localhost/dir1 ? ? ? ?http://os1.combo.com
注意:
1.如果records.config中設(shè)置了pristine_host_hdr為1,請求combo源站的Host頭將是localhost
2.combo類型的url的最大長度不得超過3000字節(jié),所包含的子請求不得超過30個
"/file1&p=/path1/&file2&file3&p=&/file4&p=/dir:path2/&file5&file6"
會得到如下文件路徑
/file1
/path1/file2
/path1/file3
/file4
/dir:path2/file5
/dir:path2/file6
參考文獻(xiàn)
[1].https://docs.trafficserver.apache.org/en/latest/reference/plugins/combo_handler.en.html
[2]. 源碼中的README文件,這個更詳細(xì)更新
總結(jié)
以上是生活随笔為你收集整理的ATS中的ComboHandler合并回源插件调研的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CentOS 6.3 64bit上测试A
- 下一篇: ATS中的动态回源插件stale-whi