Commit aab7c102 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Update zope-plone.vcl to v3 syntax

Thanks to cleberjsantos for initial patch which this is based on.

Fixes: #976
parent 7337e716
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
# Default backend is the Zope CMS # Default backend is the Zope CMS
backend default { backend default {
set backend.host = "127.0.0.1"; .host = "127.0.0.1";
set backend.port = "9673"; .port = "9673";
} }
acl purge { acl purge {
...@@ -29,10 +29,10 @@ sub vcl_recv { ...@@ -29,10 +29,10 @@ sub vcl_recv {
# requests for unknown hosts # requests for unknown hosts
if (req.http.host ~ "(www.)?example.com") { if (req.http.host ~ "(www.)?example.com") {
set req.http.host = "example.com"; set req.http.host = "example.com";
set req.url = "/VirtualHostBase/http/example.com:80/example.com/VirtualHostRoot" req.url; set req.url = "/VirtualHostBase/http/example.com:80/example.com/VirtualHostRoot" + req.url;
} elsif (req.http.host ~ "(www.)?example.org") { } elsif (req.http.host ~ "(www.)?example.org") {
set req.http.host = "example.org"; set req.http.host = "example.org";
set req.url = "/VirtualHostBase/http/example.org:80/example.org/VirtualHostRoot" req.url; set req.url = "/VirtualHostBase/http/example.org:80/example.org/VirtualHostRoot" + req.url;
} else { } else {
error 404 "Unknown virtual host."; error 404 "Unknown virtual host.";
} }
...@@ -42,7 +42,7 @@ sub vcl_recv { ...@@ -42,7 +42,7 @@ sub vcl_recv {
# POST - Logins and edits # POST - Logins and edits
if (req.request == "POST") { if (req.request == "POST") {
pass; return(pass);
} }
# PURGE - The CacheFu product can invalidate updated URLs # PURGE - The CacheFu product can invalidate updated URLs
...@@ -50,7 +50,7 @@ sub vcl_recv { ...@@ -50,7 +50,7 @@ sub vcl_recv {
if (!client.ip ~ purge) { if (!client.ip ~ purge) {
error 405 "Not allowed."; error 405 "Not allowed.";
} }
lookup; return(lookup);
} }
} }
...@@ -60,9 +60,9 @@ sub vcl_recv { ...@@ -60,9 +60,9 @@ sub vcl_recv {
# Force lookup of specific urls unlikely to need protection # Force lookup of specific urls unlikely to need protection
if (req.url ~ "\.(js|css)") { if (req.url ~ "\.(js|css)") {
remove req.http.cookie; remove req.http.cookie;
lookup; return(lookup);
} }
pass; return(pass);
} }
# The default vcl_recv is used from here. # The default vcl_recv is used from here.
...@@ -71,13 +71,14 @@ sub vcl_recv { ...@@ -71,13 +71,14 @@ sub vcl_recv {
# Do the PURGE thing # Do the PURGE thing
sub vcl_hit { sub vcl_hit {
if (req.request == "PURGE") { if (req.request == "PURGE") {
set obj.ttl = 0s; purge;
error 200 "Purged"; error 200 "Purged";
} }
} }
sub vcl_miss { sub vcl_miss {
if (req.request == "PURGE") { if (req.request == "PURGE") {
error 404 "Not in cache"; purge;
error 200 "Purged";
} }
} }
...@@ -85,7 +86,7 @@ sub vcl_miss { ...@@ -85,7 +86,7 @@ sub vcl_miss {
# from Zope by using the CacheFu product # from Zope by using the CacheFu product
sub vcl_fetch { sub vcl_fetch {
if (obj.ttl < 3600s) { if (beresp.ttl < 3600s) {
set obj.ttl = 3600s; set beresp.ttl = 3600s;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment