Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos-mynij-dev
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mynij
slapos-mynij-dev
Commits
350afbb7
Commit
350afbb7
authored
Apr 20, 2012
by
Tatuya Kamada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix indentations, add several comments.
This is a cosmetic modification. Functionally, there is no change.
parent
41552297
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
122 additions
and
142 deletions
+122
-142
slapos/recipe/generic_varnish/template/default.vcl.in
slapos/recipe/generic_varnish/template/default.vcl.in
+122
-142
No files found.
slapos/recipe/generic_varnish/template/default.vcl.in
View file @
350afbb7
...
@@ -20,17 +20,14 @@ backend default {
...
@@ -20,17 +20,14 @@ backend default {
"User-Agent: Varnish";
"User-Agent: Varnish";
}
}
}
}
#
#Below is a commented-out copy of the default VCL logic. If you
#redefine any of these subroutines, the built-in logic will be
#appended to your code.
#
# Called at the beginning of a request, after the complete request has been received and parsed
sub vcl_recv {
sub vcl_recv {
# Force lookup if the request is a no-cache request from the client
# Force lookup if the request is a no-cache request from the client
if (req.http.cache-control ~ "no-cache") {
if (req.http.cache-control ~ "no-cache") {
ban_url(req.url);
ban_url(req.url);
}
}
# Pass any requests that Varnish does not understand straight to the backend.
if (req.request != "GET" &&
if (req.request != "GET" &&
req.request != "HEAD" &&
req.request != "HEAD" &&
req.request != "PUT" &&
req.request != "PUT" &&
...
@@ -42,6 +39,7 @@ sub vcl_recv {
...
@@ -42,6 +39,7 @@ sub vcl_recv {
/* Non-RFC2616 or CONNECT which is weird. */
/* Non-RFC2616 or CONNECT which is weird. */
return(pipe);
return(pipe);
}
}
# Pass anything other than GET and HEAD and PURGE directly.
if (req.request != "GET" && req.request != "HEAD" && req.request != "PURGE") {
if (req.request != "GET" && req.request != "HEAD" && req.request != "PURGE") {
/* We only deal with GET and HEAD by default */
/* We only deal with GET and HEAD by default */
return(pass);
return(pass);
...
@@ -71,7 +69,9 @@ sub vcl_recv {
...
@@ -71,7 +69,9 @@ sub vcl_recv {
return (pass);
return (pass);
}
}
}
}
# XXX Is it OK to remove this of all the case?
remove req.http.Set-Cookie;
remove req.http.Set-Cookie;
if (req.http.Accept-Encoding) {
if (req.http.Accept-Encoding) {
if (req.http.Accept-Encoding ~ "gzip") {
if (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
set req.http.Accept-Encoding = "gzip";
...
@@ -84,14 +84,6 @@ sub vcl_recv {
...
@@ -84,14 +84,6 @@ sub vcl_recv {
}
}
# We do not care about Accept-Language, this is url controlled
# We do not care about Accept-Language, this is url controlled
remove req.http.Accept-Language;
remove req.http.Accept-Language;
#if (req.request == "PURGE") {
# if (!client.ip ~ purge) {
# error 405 "Not allowed.";
# }
# purge_url(req.url);
# error 200 "HASHPURGED";
# unset req.http.x;
#}
## XXX login form can defer based on __ac_name cookie value
## XXX login form can defer based on __ac_name cookie value
if (req.url ~ "/(login_form|WebSite_viewLoginDialog)($|\?)") {
if (req.url ~ "/(login_form|WebSite_viewLoginDialog)($|\?)") {
...
@@ -106,22 +98,14 @@ sub vcl_recv {
...
@@ -106,22 +98,14 @@ sub vcl_recv {
return(lookup);
return(lookup);
}
}
# Creates the varnish cache key by the url
sub vcl_hash {
sub vcl_hash {
hash_data(req.url);
hash_data(req.url);
return(hash);
return(hash);
}
}
# Called after a cache lookup if the requested document was found in the cache
sub vcl_hit {
sub vcl_hit {
#if (req.request == "PURGE" && client.ip ~ purge) {
# set obj.ttl = 0s;
# error 200 "Purged.";
#}
#if (client.ip ~ purge){
# # Force refresh from localhost
# set obj.ttl = 0s;
# return (restart);
#}
# According Vary Header do not return those headers
# According Vary Header do not return those headers
remove req.http.Accept-Language;
remove req.http.Accept-Language;
remove req.http.Accept-Encoding;
remove req.http.Accept-Encoding;
...
@@ -129,10 +113,12 @@ sub vcl_hit {
...
@@ -129,10 +113,12 @@ sub vcl_hit {
return(deliver);
return(deliver);
}
}
# Called after a cache lookup if the requested document was not found in the cache
sub vcl_miss {
sub vcl_miss {
return(fetch);
return(fetch);
}
}
# Called after a document has been successfully retrieved from the backend
sub vcl_fetch {
sub vcl_fetch {
# we only cache 200 (OK) and 304 (Not Modified) responses.
# we only cache 200 (OK) and 304 (Not Modified) responses.
if (beresp.status != 200 && beresp.status != 304) {
if (beresp.status != 200 && beresp.status != 304) {
...
@@ -170,7 +156,6 @@ sub vcl_fetch {
...
@@ -170,7 +156,6 @@ sub vcl_fetch {
/* Never send request to backend even if client ask refreshed content */
/* Never send request to backend even if client ask refreshed content */
if (beresp.ttl > 0s) {
if (beresp.ttl > 0s) {
/* Setup grace period for 30days for all cacheable contents */
/* Setup grace period for 30days for all cacheable contents */
#set req.grace = 30d;
set beresp.grace = 30d;
set beresp.grace = 30d;
/* Remove Expires from backend, it's not long enough */
/* Remove Expires from backend, it's not long enough */
unset beresp.http.expires;
unset beresp.http.expires;
...
@@ -181,10 +166,11 @@ sub vcl_fetch {
...
@@ -181,10 +166,11 @@ sub vcl_fetch {
/* marker for vcl_deliver to reset Age: */
/* marker for vcl_deliver to reset Age: */
set beresp.http.magicmarker = "1";
set beresp.http.magicmarker = "1";
}
}
return(deliver);
}
return(deliver);
}
# Called before a cached object is delivered to the client
sub vcl_deliver {
sub vcl_deliver {
if (resp.http.magicmarker) {
if (resp.http.magicmarker) {
/* Remove the magic marker */
/* Remove the magic marker */
...
@@ -197,11 +183,5 @@ sub vcl_deliver {
...
@@ -197,11 +183,5 @@ sub vcl_deliver {
} else {
} else {
set resp.http.X-Cache = "MISS";
set resp.http.X-Cache = "MISS";
}
}
#if (obj.hash) {
# set resp.http.X-Hash = obj.hash;
#} else {
# set resp.http.X-Hash = "No hash";
#}
return(deliver);
return(deliver);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment