aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/varnish64/varnish.inc20
-rw-r--r--config/varnish64/varnish_custom_vcl.xml16
2 files changed, 29 insertions, 7 deletions
diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc
index e99e90c1..dc343a44 100644
--- a/config/varnish64/varnish.inc
+++ b/config/varnish64/varnish.inc
@@ -35,6 +35,10 @@ function sync_package_varnish() {
global $config, $g;
if($config['installedpackages']['varnishcustomvcl']['config'] != "") {
foreach($config['installedpackages']['varnishcustomvcl']['config'] as $vcl) {
+ if($vcl['vcl_recv_early'])
+ $vcl_recv_early = $vcl['vcl_recv_early'];
+ if($vcl['vcl_recv_late'])
+ $vcl_recv_late = $vcl['vcl_recv_late'];
if($vcl['vcl_fetch_early'])
$vcl_fetch_early = $vcl['vcl_fetch_early'];
if($vcl['vcl_fetch_late'])
@@ -139,16 +143,18 @@ EOAU;
foreach($config['installedpackages']['varnishbackends']['config'] as $urlmapping) {
if($config['installedpackages']['varnishbackends']['config'])
foreach($config['installedpackages']['varnishbackends']['config'] as $urlmapping) {
- foreach($urlmapping['row'] as $url)
- if(!$isfirst)
- $urlmappings .= "else ";
- $urlmappings .= <<<EOAU
+ if($urlmapping['row'])
+ foreach($urlmapping['row'] as $url) {
+ if(!$isfirst)
+ $urlmappings .= "else ";
+ $urlmappings .= <<<EOAU
if (req.http.host == "{$url['urlmapping']}") {
set req.backend = {$urlmapping['backendname']};
set req.http.host = "{$urlmapping['urlmapping']}";
}
EOAU;
- $isfirst = false;
+ $isfirst = false;
+ }
}
}
@@ -246,7 +252,7 @@ sub vcl_error {
{$backends}
sub vcl_recv {
- {$vcl_recv_custom_early}
+ {$vcl_recv_early}
# If the client sent an X-Forwarded-For header, remove it.
# It cannot betrusted.
unset req.http.X-Forwarded-For;
@@ -270,7 +276,7 @@ sub vcl_recv {
}
}
{$urlmappings}
- {$vcl_recv_custom_late}
+ {$vcl_recv_late}
if (req.request != "GET" && req.request != "HEAD") {
return(pipe);
}
diff --git a/config/varnish64/varnish_custom_vcl.xml b/config/varnish64/varnish_custom_vcl.xml
index f9251454..7b35426a 100644
--- a/config/varnish64/varnish_custom_vcl.xml
+++ b/config/varnish64/varnish_custom_vcl.xml
@@ -74,6 +74,22 @@
</tabs>
<fields>
<field>
+ <fielddescr>vcl_recv_early</fielddescr>
+ <fieldname>vcl_recv_early</fieldname>
+ <description>Paste your custom <![CDATA[<a target=_new href='http://varnish-cache.org/wiki/VCL'>vcl_recv</a>]]> code here. This code will be included at the beginning of the vcl_recv function.</description>
+ <type>textarea</type>
+ <cols>50</cols>
+ <rows>10</rows>
+ </field>
+ <field>
+ <fielddescr>vcl_recv_late</fielddescr>
+ <fieldname>vcl_recv_late</fieldname>
+ <description>Paste your custom <![CDATA[<a target=_new href='http://varnish-cache.org/wiki/VCL'>vcl_recv</a>]]> code here. This code will be included at the end of the vcl_recv function.</description>
+ <type>textarea</type>
+ <cols>50</cols>
+ <rows>10</rows>
+ </field>
+ <field>
<fielddescr>vcl_fetch_early</fielddescr>
<fieldname>vcl_fetch_early</fieldname>
<description>Paste your custom <![CDATA[<a target=_new href='http://varnish-cache.org/wiki/VCL'>vcl_fetch</a>]]> code here. This code will be included at the beginning of the vcl_fetch function.</description>