First hacked up varnish vcl for stg that works with 4.0
This commit is contained in:
parent
7cb1bee6ea
commit
3b964174d5
1 changed files with 71 additions and 79 deletions
|
@ -1,15 +1,6 @@
|
||||||
vcl 4.0;
|
vcl 4.0;
|
||||||
#This is a basic VCL configuration file for varnish. See the vcl(7)
|
|
||||||
#man page for details on VCL syntax and semantics.
|
import directors;
|
||||||
#
|
|
||||||
#Default backend definition. Set this to point to your content
|
|
||||||
#server.
|
|
||||||
#
|
|
||||||
sub vcl_error {
|
|
||||||
if (obj.status == 400 || obj.status == 413) {
|
|
||||||
return(deliver);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
backend wiki {
|
backend wiki {
|
||||||
.host = "localhost";
|
.host = "localhost";
|
||||||
|
@ -64,10 +55,11 @@ backend fas03 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
director fas round-robin {
|
sub vcl_init {
|
||||||
{ .backend = fas01; }
|
new fas = directors.round_robin();
|
||||||
{ .backend = fas02; }
|
fas.add_backend(fas01);
|
||||||
{ .backend = fas03; }
|
fas.add_backend(fas02);
|
||||||
|
fas.add_backend(fas03);
|
||||||
}
|
}
|
||||||
|
|
||||||
backend voting {
|
backend voting {
|
||||||
|
@ -126,82 +118,82 @@ backend paste {
|
||||||
.port = "10027";
|
.port = "10027";
|
||||||
}
|
}
|
||||||
|
|
||||||
acl purge {
|
#acl purge {
|
||||||
"192.168.1.3";
|
# "192.168.1.3";
|
||||||
"192.168.1.4";
|
# "192.168.1.4";
|
||||||
"192.168.1.5";
|
# "192.168.1.5";
|
||||||
"192.168.1.6";
|
# "192.168.1.6";
|
||||||
"192.168.1.13";
|
# "192.168.1.13";
|
||||||
"192.168.1.24";
|
# "192.168.1.24";
|
||||||
"192.168.1.23";
|
# "192.168.1.23";
|
||||||
"192.168.1.41";
|
# "192.168.1.41";
|
||||||
"10.5.126.31";
|
# "10.5.126.31";
|
||||||
"10.5.126.32";
|
# "10.5.126.32";
|
||||||
"10.5.126.33";
|
# "10.5.126.33";
|
||||||
"10.5.126.34";
|
# "10.5.126.34";
|
||||||
"10.5.126.37";
|
# "10.5.126.37";
|
||||||
"10.5.126.38";
|
# "10.5.126.38";
|
||||||
}
|
#}
|
||||||
|
|
||||||
sub vcl_recv {
|
sub vcl_recv {
|
||||||
if (req.request == "PURGE") {
|
# if (req.request == "PURGE") {
|
||||||
if (!client.ip ~ purge) {
|
# if (!client.ip ~ purge) {
|
||||||
error 405 "Not allowed.";
|
# error 405 "Not allowed.";
|
||||||
}
|
# }
|
||||||
if (req.url ~ "^http://") {
|
# if (req.url ~ "^http://") {
|
||||||
set req.url = regsub(req.url, "http://localhost:6081","");
|
# set req.url = regsub(req.url, "http://localhost:6081","");
|
||||||
}
|
# }
|
||||||
purge_url(req.url);
|
# purge_url(req.url);
|
||||||
}
|
# }
|
||||||
|
|
||||||
if (req.url ~ "^/wiki/") {
|
if (req.url ~ "^/wiki/") {
|
||||||
set req.backend = wiki;
|
set req.backend_hint = wiki;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/w/") {
|
if (req.url ~ "^/w/") {
|
||||||
set req.backend = wiki;
|
set req.backend_hint = wiki;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/pkgdb/appicon/show/") {
|
if (req.url ~ "^/pkgdb/appicon/show/") {
|
||||||
set req.backend = pkgdb;
|
set req.backend_hint = pkgdb;
|
||||||
unset req.http.cookie;
|
unset req.http.cookie;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/mirrorlist/") {
|
if (req.url ~ "^/mirrorlist/") {
|
||||||
set req.backend = mirrorlists;
|
set req.backend_hint = mirrorlists;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/pkgdb") {
|
if (req.url ~ "^/pkgdb") {
|
||||||
set req.backend = pkgdb;
|
set req.backend_hint = pkgdb;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/accounts/") {
|
if (req.url ~ "^/accounts/") {
|
||||||
set req.backend = fas;
|
set req.backend_hint = fas.backend();
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/voting/") {
|
if (req.url ~ "^/voting/") {
|
||||||
set req.backend = voting;
|
set req.backend_hint = voting;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/mirrormanager/") {
|
if (req.url ~ "^/mirrormanager/") {
|
||||||
set req.backend = mirrormanager;
|
set req.backend_hint = mirrormanager;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/updates/") {
|
if (req.url ~ "^/updates/") {
|
||||||
set req.backend = bodhi;
|
set req.backend_hint = bodhi;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/freemedia/") {
|
if (req.url ~ "^/freemedia/") {
|
||||||
set req.backend = freemedia;
|
set req.backend_hint = freemedia;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/packages/") {
|
if (req.url ~ "^/packages/") {
|
||||||
set req.backend = packages;
|
set req.backend_hint = packages;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/tagger/") {
|
if (req.url ~ "^/tagger/") {
|
||||||
set req.backend = tagger;
|
set req.backend_hint = tagger;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/calendar") {
|
if (req.url ~ "^/calendar") {
|
||||||
set req.backend = fedocal;
|
set req.backend_hint = fedocal;
|
||||||
}
|
}
|
||||||
if (req.url ~ "^/kerneltest") {
|
if (req.url ~ "^/kerneltest") {
|
||||||
set req.backend = kerneltest;
|
set req.backend_hint = kerneltest;
|
||||||
}
|
}
|
||||||
if (req.http.X-Forwarded-Server ~ "^paste.fedoraproject.org") {
|
if (req.http.X-Forwarded-Server ~ "^paste.fedoraproject.org") {
|
||||||
set req.backend = paste;
|
set req.backend_hint = paste;
|
||||||
}
|
}
|
||||||
if (req.http.X-Forwarded-Server ~ "^ask.fedoraproject.org") {
|
if (req.http.X-Forwarded-Server ~ "^ask.fedoraproject.org") {
|
||||||
set req.backend = askbot;
|
set req.backend_hint = askbot;
|
||||||
if (req.url ~ "^/m/") {
|
if (req.url ~ "^/m/") {
|
||||||
unset req.http.cookie;
|
unset req.http.cookie;
|
||||||
set req.url = regsub(req.url, "\?.*", "");
|
set req.url = regsub(req.url, "\?.*", "");
|
||||||
|
@ -209,7 +201,7 @@ sub vcl_recv {
|
||||||
}
|
}
|
||||||
if (req.http.X-Forwarded-Server ~ "^qa.fedoraproject.org") {
|
if (req.http.X-Forwarded-Server ~ "^qa.fedoraproject.org") {
|
||||||
if (req.url ~ "^/blockerbugs") {
|
if (req.url ~ "^/blockerbugs") {
|
||||||
set req.backend = blockerbugs;
|
set req.backend_hint = blockerbugs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,28 +211,28 @@ 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") {
|
||||||
purge_url(req.url);
|
# purge_url(req.url);
|
||||||
}
|
# }
|
||||||
if (req.http.Accept-Encoding) {
|
# if (req.http.Accept-Encoding) {
|
||||||
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
|
# if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
|
||||||
# No point in compressing these
|
# # No point in compressing these
|
||||||
remove req.http.Accept-Encoding;
|
# remove req.http.Accept-Encoding;
|
||||||
} elsif (req.http.Accept-Encoding ~ "gzip") {
|
# } elsif (req.http.Accept-Encoding ~ "gzip") {
|
||||||
# This is currently a bug with ipv6, so we need to nuke it.
|
# # This is currently a bug with ipv6, so we need to nuke it.
|
||||||
remove req.http.Accept-Encoding;
|
# remove req.http.Accept-Encoding;
|
||||||
} elsif (req.http.Accept-Encoding ~ "deflate") {
|
# } elsif (req.http.Accept-Encoding ~ "deflate") {
|
||||||
set req.http.Accept-Encoding = "deflate";
|
# set req.http.Accept-Encoding = "deflate";
|
||||||
} else {
|
# } else {
|
||||||
# unknown algorithm
|
# # unknown algorithm
|
||||||
remove req.http.Accept-Encoding;
|
# remove req.http.Accept-Encoding;
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
# When requesting application icons, don't allow cherrypy to set cookies
|
# When requesting application icons, don't allow cherrypy to set cookies
|
||||||
sub vcl_fetch {
|
#sub vcl_backend_fetch {
|
||||||
if (req.url ~ "^/pkgdb/appicon/show/") {
|
# if (req.url ~ "^/pkgdb/appicon/show/") {
|
||||||
unset beresp.http.set-cookie;
|
# unset beresp.http.set-cookie;
|
||||||
}
|
# }
|
||||||
}
|
#}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue