diff options
-rw-r--r-- | config/varnish64/varnish.inc | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc index 70425409..1ec000e7 100644 --- a/config/varnish64/varnish.inc +++ b/config/varnish64/varnish.inc @@ -99,29 +99,12 @@ synthetic {" </body> </html> "}; -deliver; +return(deliver); EOF; $backends = ""; $urlmappings = ""; - - if($config['installedpackages']['varnishlbdirectors']['config'] != "") { - foreach($config['installedpackages']['varnishlbdirectors']['config'] as $backend) { - $director = ""; - if($backend['row']) - foreach($backend['row'] as $be) - $director .= "\t{\n\t\t.backend = {$be['backendname']};\n\t}"; - $backends .= <<<EOFA -director {$backend['directorname']} {$backend['directortype']} { -{$director} -} - - -EOFA; - } - } - if($config['installedpackages']['varnishbackends']['config'] != "") { foreach($config['installedpackages']['varnishbackends']['config'] as $backend) { @@ -133,7 +116,7 @@ EOFA; $urlmappings .= "else "; $urlmappings .= <<<EOAU if (req.http.host == "{$url['directorurl']}") { - set req.backend = "{$url['directorname']}"; + set req.backend = {$url['directorname']}; set req.http.host = "{$url['directorurl']}"; } EOAU; @@ -149,7 +132,7 @@ EOAU; $urlmappings .= "else "; $urlmappings .= <<<EOAU if (req.http.host == "{$url['urlmapping']}") { - set req.backend = "{$urlmapping['backendname']}"; + set req.backend = {$urlmapping['backendname']}; set req.http.host = "{$urlmapping['urlmapping']}"; } EOAU; @@ -162,25 +145,41 @@ EOAU; else $connect_timeout = "25s"; if($backend['port']) - $connect_timeout = $backend['port']; + $connect_timeout = $backend['port'] . "s"; else $connect_timeout = "80"; if($backend['first_byte_timeout']) - $first_byte_timeout = $backend['first_byte_timeout']; + $first_byte_timeout = $backend['first_byte_timeout'] . "s"; else $first_byte_timeout = "300s"; $backends .= <<<EOFA backend {$backend['backendname']} { .host = "{$backend['ipaddress']}"; .port = "{$backend['port']}"; - .first_byte_timeout = "{$first_byte_timeout}"; - .connect_timeout = "{$connect_timeout}"; + .first_byte_timeout = {$first_byte_timeout}; + .connect_timeout = {$connect_timeout}; } EOFA; } } + if($config['installedpackages']['varnishlbdirectors']['config'] != "") { + foreach($config['installedpackages']['varnishlbdirectors']['config'] as $backend) { + $director = ""; + if($backend['row']) + foreach($backend['row'] as $be) + $director .= "\t{\n\t\t.backend = {$be['backendname']};\n\t}"; + $backends .= <<<EOFA +director {$backend['directorname']} {$backend['directortype']} { +{$director} +} + + +EOFA; + } + } + if($vcl_fetch_early or $vcl_fetch_late) { $vcl_fetch = <<<FETCH sub vcl_fetch { @@ -229,7 +228,7 @@ sub vcl_recv { {$urlmappings} {$vcl_recv_custom_late} if (req.request != "GET" && req.request != "HEAD") { - pipe; + return(pipe); } return(lookup); } |