diff options
Diffstat (limited to 'config/varnish64/varnish.inc')
-rw-r--r-- | config/varnish64/varnish.inc | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc index 5df22487..d69d6abd 100644 --- a/config/varnish64/varnish.inc +++ b/config/varnish64/varnish.inc @@ -31,7 +31,19 @@ */ /* ========================================================================== */ -function sync_package_varnish() { +function sync_package_varnish() { + if($config['installedpackages']['varnishcustomvcl']['config'] != "") { + foreach($config['installedpackages']['varnishcustomvcl']['config'] as $vcl) { + if($vcl['vcl_fetch_early']) + $vcl_fetch_early = $vcl['vcl_fetch_early']; + if($vcl['vcl_fetch_late']) + $vcl_fetch_late = $vcl['vcl_fetch_late']; + if($vcl['vcl_pipe_early']) + $vcl_pipe_early = $vcl['vcl_pipe_early']; + if($vcl['vcl_pipe_late']) + $vcl_pipe_late = $vcl['vcl_pipe_late']; + } + } if($config['installedpackages']['varnishsettings']['config'] != "") { foreach($config['installedpackages']['varnishsettings']['config'] as $vs) { if($vs['storagetype'] == "malloc") @@ -44,7 +56,7 @@ function sync_package_varnish() { $listeningport = "-a :80"; } $fd = fopen("/usr/local/etc/rc.d/varnish.sh", "w"); - $rc_file = <<<EOF; + $rc_file = <<<EOF #!/bin/sh mkdir -p /var/varnish rm /var/varnish/storage.bin 2>/dev/null @@ -59,7 +71,7 @@ sleep 1 EOF; fwrite($fd, $rc_file); fclose($fd); - exec("chmod a+rx /usr/local/etc/rc.d/varnish.sh") + exec("chmod a+rx /usr/local/etc/rc.d/varnish.sh"); } if(!$errorvcl) @@ -99,7 +111,7 @@ EOF; foreach($config['installedpackages']['varnishurlmappings']['config'] as $urlmapping) { if(!$isfirst) $urlmappings .= "else "; - $urlmappings = <<<EOAU; + $urlmappings = <<<EOAU if (req.http.host == "{$urlmapping['url']}") { set req.backend = {$urlmapping['backend']}; } @@ -119,7 +131,7 @@ EOAU; $first_byte_timeout = $backend['first_byte_timeout']; else $first_byte_timeout = "300s"; - $backends .= <<<EOFA; + $backends .= <<<EOFA backend {$backend['backendname']} { .host = "{$backend['ipaddress']}"; .port = "{$backend['port']}"; @@ -130,10 +142,8 @@ backend {$backend['backendname']} { EOFA; } } -} $varnish_config_file = <<<EOF - # Varnish configuration file # Automatically generated by the pfSense package system |