0
我用清漆4,PHP-FPM 7,nginx的,CentOS的7光油4 ESI:bereq.url不讀ESI SRC標籤內的網址
我varnish.params:
DAEMON_OPTS="-a :80 -T 127.0.0.1:6082
-f /etc/varnish/default.vcl
-S /etc/varnish/secret
-s malloc,1g
-p feature=+esi_disable_xml_check,+esi_ignore_other_elements
-p cli_buffer=16384
-p vcc_allow_inline_c=on"
我default.vcl:
if (bereq.url ~ "^.*(\/**esi**\/)+.*$") {
set beresp.do_esi = true;
set beresp.ttl = 0s;
} else {
set beresp.ttl = 3600s;
}
我的問題是,當我使用它是通過訪問觸發VCL代碼說:http://localhost/lab/varnish
其中渲染:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<esi:include src="http://localhost/lab/esi/body"/>
</body>
</html>
光油沒有讀取ESI標籤中的URL src,所以它只是渲染一個空的主體。
但是,當我使用此代碼:
if (bereq.url ~ "^.*(\/**lab**\/)+.*$") {
set beresp.do_esi = true;
set beresp.ttl = 0s;
} else {
set beresp.ttl = 3600s;
}
光油成功地使這是由生產ESI標籤中的內容: http://localhost/lab/esi/body
如何使光油觸發ESI片段渲染基於識別ESI「src」標籤中的內容?
我試過設置代理能力和使用代理控制檢查,它也不適用於我。我正在用盡線索..
我希望varnish使用已經緩存的內容向客戶端提供服務,並且僅從ESI標籤內的源代碼中排除(請求後端)內容。是否可以這樣做? –