ESI problem in Red Hat Enterprise Linux
彭伟
weipeng.pengw at alibaba-inc.com
Thu Mar 17 04:01:01 CET 2011
hi all:
i install varnish using the source code "varnish-2.1.4.tar.gz" in ubuntu10.4
and "Red Hat Enterprise Linux Server release 5.3 (Tikanga)"
when i use ESI in ubuntu, it's ok, both the main page and the esi included page can be showed
but the same configure file and the same pages in redhat, only the main page can be showed
the configure file is as below:
backend default {
.host = "127.0.0.1";
.port = "80";
}
backend javaeye {
.host = "www.javaeye.com<http://www.javaeye.com>";
.port = "80";
.connect_timeout = 1s;
.first_byte_timeout = 5s;
.between_bytes_timeout = 2s;
}
acl purge {
"localhost";
"127.0.0.1";
"192.168.1.0"/24;
}
sub vcl_recv {
if (req.request == "PURGE") {
if (!client.ip ~ purge) {
error 405 "Not allowed.";
}
return(lookup);
}
if (req.url ~ "^/forums/") {
set req.backend = javaeye;
set req.http.Host="www.javaeye.com<http://www.javaeye.com>";
return (pass);
} else {
set req.backend = default;
}
if (req.restarts == 0) {
if (req.http.x-forwarded-for) {
set req.http.X-Forwarded-For =
req.http.X-Forwarded-For ", " client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
}
}
if (req.request != "GET" &&
req.request != "HEAD" &&
req.request != "PUT" &&
req.request != "POST" &&
req.request != "TRACE" &&
req.request != "OPTIONS" &&
req.request != "DELETE") {
return (pipe);
}
if (req.request != "GET" && req.request != "HEAD") {
/* We only deal with GET and HEAD by default */
return (pass);
}
if (req.http.Authorization || req.http.Cookie) {
return (pass);
}
return (lookup);
}
sub vcl_pass {
return (pass);
}
sub vcl_hit {
if (req.request == "PURGE") {
set obj.ttl = 0s;
error 200 "Purged.";
}
if (!obj.cacheable) {
return (pass);
}
return (deliver);
}
sub vcl_miss {
if (req.request == "PURGE") {
error 404 "Not in cache.";
}
return (fetch);
}
sub vcl_fetch {
if (req.url ~ "/[a-z0-9]+.html$") {
esi; /* Do ESI processing */
}
remove beresp.http.Last-Modified;
remove beresp.http.Etag;
#set beresp.http.Cache-Control="no-cache";
if (!beresp.cacheable) {
return (pass);
}
if (beresp.http.Set-Cookie) {
return (pass);
}
if (req.url ~ "^/[a-z]+/") {
/* We only deal with GET and HEAD by default */
return (pass);
}
return (deliver);
}
sub vcl_deliver {
return (deliver);
}
sub vcl_error {
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>"} obj.status " " obj.response {"</title>
</head>
<body>
<h1>Error "} obj.status " " obj.response {"</h1>
<p>"} obj.response {"</p>
<h3>Guru Meditation:</h3>
<p>XID: "} req.xid {"</p>
<hr>
<p>Varnish cache server</p>
</body>
</html>
"};
return (deliver);
}
the main page url: http://10.20.156.7:8000/haha.html
the main page content:
<html>
<body>
123haha111
<esi:include src="/forums/board/java" />
</body>
</html>
please help me! thanks !
Regards!
pwlazy
________________________________
This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.
本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110317/eb7b96da/attachment-0003.html>
More information about the varnish-misc
mailing list