diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-04-27 19:56:38 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-04-27 19:56:47 -0400 |
commit | e2bdf0c49f41f239379cc5047170b398e4ef48f9 (patch) | |
tree | fb64cbb482e1f4ebb06069949fb7fe9e9957fba0 /config/varnish64 | |
parent | 883feaf113a72b2c940be0012d2df1b4abc0c293 (diff) | |
download | pfsense-packages-e2bdf0c49f41f239379cc5047170b398e4ef48f9.tar.gz pfsense-packages-e2bdf0c49f41f239379cc5047170b398e4ef48f9.tar.bz2 pfsense-packages-e2bdf0c49f41f239379cc5047170b398e4ef48f9.zip |
Add vcl_recv field
Diffstat (limited to 'config/varnish64')
-rw-r--r-- | config/varnish64/varnish.inc | 20 | ||||
-rw-r--r-- | config/varnish64/varnish_custom_vcl.xml | 16 |
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> |