aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-26 08:30:23 -0700
committerMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-26 08:30:23 -0700
commit6f442f7d8a0aebad32178b77e18ea2385d12f157 (patch)
treefa55864078c21bf844dd51ca2e6cf769b53ac88d
parent1047008dc92dd10dc1c929e4b676bb02d733ac58 (diff)
parente46559b162e884b50f936ea38aa1d0e81cfe2c35 (diff)
downloadpfsense-packages-6f442f7d8a0aebad32178b77e18ea2385d12f157.tar.gz
pfsense-packages-6f442f7d8a0aebad32178b77e18ea2385d12f157.tar.bz2
pfsense-packages-6f442f7d8a0aebad32178b77e18ea2385d12f157.zip
Merge pull request #264 from djgel/patch-2
-rw-r--r--config/varnish3/varnish.inc14
1 files changed, 11 insertions, 3 deletions
diff --git a/config/varnish3/varnish.inc b/config/varnish3/varnish.inc
index 9e78d41f..03aadc67 100644
--- a/config/varnish3/varnish.inc
+++ b/config/varnish3/varnish.inc
@@ -5,6 +5,7 @@
part of pfSense (http://www.pfSense.com)
Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2011 Marcello Coutinho
+ Copyright (C) 2012 Márcio Carlos Antão
All rights reserved.
*/
/* ========================================================================== */
@@ -129,8 +130,7 @@ function varnish_get_url_mappings_txt() {
if($url['grace'])
$directo_grace_time.=($url['grace']=="0s"?"return(pass);":"set req.grace=".$url['grace'].";");
$fieldtype = ($url['fieldtype']?$url['fieldtype']:"==");
- $req=($url['directorurl2']?"url":"http.host");
- $director_prefix=($url['directorurl'] && $url['directorurl2']?"^http://":"");
+ $director_prefix=($url['directorurl'] && $url['directorurl2']?"^http://":"");
#check url
if ( $url['directorurl'] || $url['directorurl2'] || $catch_all == "unset" ){
if ( $url['directorurl']== "" && $url['directorurl2']== "" ){
@@ -142,7 +142,15 @@ function varnish_get_url_mappings_txt() {
else{
if(!$isfirst)
$urlmappings .= "\telse ";
- $urlmappings .= "if (req.$req $fieldtype ".'"'.$url['directorurl'].$url['directorurl2'].'") {'."\n";
+ if(!$url['directorurl']) {
+ $urlmappings .= "if (req.url $fieldtype ".'"^'.$url['directorurl2'].'") {'."\n";
+ }
+ else if (!$url['directorurl2']) {
+ $urlmappings .= "if (req.http.host $fieldtype ".'"'.$url['directorurl'].'") {'."\n";
+ }
+ else {
+ $urlmappings .= "if (req.http.host $fieldtype ".'"'.$url['directorurl'].'"'." && req.url $fieldtype ".'"^'.$url['directorurl2'].'") {'."\n";
+ }
#check failover
$urlbackend = "\t\t\tset req.backend = ".$url['directorname'].";";
if ($url['failover'] && $url['failover'] != $url['directorname']){