ATS push cache 测试
測試 ATS 注入緩存
參考了:?http://serverfault.com/questions/471684/push-content-to-apache-traffic-servers-cache
得到返回:HTTP/1.0 400 Response Not Cachable
搜索得知,頭部傳入信息太少,必須包含反映時間的項。那個回答應該是針對舊的 ATS 版本。
這里也有一個參考,更準確些 http://zymlinux.net/trafficserver/FAQ.html
查看官方文檔中?proxy-config-http-cache-required-headers?的解釋。默認值為2。
修改內容為
PUSH http://www.company.com HTTP/1.0
Content-length: 84
HTTP/1.0 200 OK
Content-type: text/html
Expires: Wed, 29 Nov 2015 07:23:09 GMT
Cache-Control: max-age=60
Content-length: 17
<HTML>
a
</HTML>
重新提交,得到返回:HTTP/1.0 400 Bad Content Length
原來增加了內容,忘了修改Content-length,修改為142,再次提交,成功了
最后整體顯示:
$ telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
PUSH http://www.company.com HTTP/1.0
Content-length: 142
HTTP/1.0 200 OK
Content-type: text/html
Expires: Wed, 29 Nov 2015 07:23:09 GMT
Cache-Control: max-age=60
Content-length: 17
<HTML>
a
</HTML>HTTP/1.0 201 Created
Date: Fri, 11 Sep 2015 06:03:24 GMT
Server: ATS/5.3.1
Content-Length: 0
Connection closed by foreign host.
aaa@xxx:~$ </HTML>
開啟http_ui,在瀏覽器輸入?http://localhost:8080/cache/lookup_url?url=http://www.company.com?
可以看到已經可以查到了。
注意兩個問題:
1. request 的 url 為?http://www.company.com/,最后多了一個 ’/'。
2. size 為 11, 而不是上面的 17,最后的 "</HTML>" 沒有被寫入,而且返回信息直接跟在了后面。應該是前面的length 142計算錯了。修改為148再換一個url push一次,OK 了。
?
?
?
?
轉載于:https://www.cnblogs.com/elodio/p/4800959.html
總結
以上是生活随笔為你收集整理的ATS push cache 测试的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 水系图一般在哪里找得到_虹吸雨水排水系统
- 下一篇: 北京天通苑二房东、黑中介