Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 606f660

Browse filesBrowse files
committed
fixed markup
1 parent e335fa7 commit 606f660
Copy full SHA for 606f660

File tree

Expand file treeCollapse file tree

1 file changed

+41
-41
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+41
-41
lines changed

‎cookbook/cache/varnish.rst

Copy file name to clipboardExpand all lines: cookbook/cache/varnish.rst
+41-41Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -127,54 +127,54 @@ that will invalidate the cache for a given resource:
127127
You must protect the ``PURGE`` HTTP method somehow to avoid random people
128128
purging your cached data. You can do this by setting up an access list:
129129

130-
.. code-block:: text
131-
/*
132-
Connect to the backend server
133-
on the local machine on port 8080
134-
*/
135-
backend default {
136-
.host = "127.0.0.1";
137-
.port = "8080";
138-
}
130+
.. code-block:: text
139131
140-
// Acl's can contain IP's, subnets and hostnames
141-
acl purge {
142-
"localhost";
143-
"192.168.55.0"/24;
144-
}
132+
/*
133+
Connect to the backend server
134+
on the local machine on port 8080
135+
*/
136+
backend default {
137+
.host = "127.0.0.1";
138+
.port = "8080";
139+
}
145140
146-
sub vcl_recv {
147-
// Match PURGE request to avoid cache bypassing
148-
if (req.request == "PURGE") {
149-
// Match client IP to the acl
150-
if (!client.ip ~ purge) {
151-
// Deny access
152-
error 405 "Not allowed.";
153-
}
154-
// Perform a cache lookup
155-
return(lookup);
141+
// Acl's can contain IP's, subnets and hostnames
142+
acl purge {
143+
"localhost";
144+
"192.168.55.0"/24;
156145
}
157-
}
158-
159-
sub vcl_hit {
160-
// Match PURGE request
161-
if (req.request == "PURGE") {
162-
// Force object expiration for Varnish < 3.0
163-
set obj.ttl = 0s;
164-
// Do an actual purge for Varnish >= 3.0
165-
// purge;
166-
error 200 "Purged";
146+
147+
sub vcl_recv {
148+
// Match PURGE request to avoid cache bypassing
149+
if (req.request == "PURGE") {
150+
// Match client IP to the acl
151+
if (!client.ip ~ purge) {
152+
// Deny access
153+
error 405 "Not allowed.";
154+
}
155+
// Perform a cache lookup
156+
return(lookup);
157+
}
167158
}
168-
}
169159
170-
sub vcl_miss {
171-
// Match PURGE request
172-
if (req.request == "PURGE") {
173-
// Indicate that the object isn't stored in cache
174-
error 404 "Not purged";
160+
sub vcl_hit {
161+
// Match PURGE request
162+
if (req.request == "PURGE") {
163+
// Force object expiration for Varnish < 3.0
164+
set obj.ttl = 0s;
165+
// Do an actual purge for Varnish >= 3.0
166+
// purge;
167+
error 200 "Purged";
168+
}
175169
}
176-
}
177170
171+
sub vcl_miss {
172+
// Match PURGE request
173+
if (req.request == "PURGE") {
174+
// Indicate that the object isn't stored in cache
175+
error 404 "Not purged";
176+
}
177+
}
178178
179179
.. _`Edge Architecture`: http://www.w3.org/TR/edge-arch
180180
.. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.