Caching without file extensions
Posted
by
Sigurs
on Server Fault
See other posts from Server Fault
or by Sigurs
Published on 2012-12-05T04:30:51Z
Indexed on
2012/12/05
5:08 UTC
Read the original article
Hit count: 432
I'm trying to use Varnish to show the non-logged in users a cached version of my website. I'm able to perfectly detect if the user is logged in or out, but I can't cache pages without extensions.
There is no file extension because nginx is rewriting the URL to a php script(so caching .php does not work).
For example I'd like varnish to cache: example.com example.com/forum/ example.com/contact/
I have tried
if (req.request == "GET" && req.url ~ "^/") {
return(lookup);
}
if (req.request == "GET" && req.url ~ "") {
return(lookup);
}
if (req.request == "GET" && req.url ~ "/") {
return(lookup);
}
but nothing seems to work... any help?
© Server Fault or respective owner