diff options
author | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-06-26 15:38:58 -0700 |
---|---|---|
committer | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-06-26 15:38:58 -0700 |
commit | 42a9c6500c0d8677550b72ea961fe1c6e4916859 (patch) | |
tree | 0558bd8f8d27357fa5a0124bb92fd80dabee355c /config/varnish64 | |
parent | 6a519243e039ad981d297ffd35957e24b50cdc11 (diff) | |
parent | 3577412e57c973cd7870a8f55592a93288132a2e (diff) | |
download | pfsense-packages-42a9c6500c0d8677550b72ea961fe1c6e4916859.tar.gz pfsense-packages-42a9c6500c0d8677550b72ea961fe1c6e4916859.tar.bz2 pfsense-packages-42a9c6500c0d8677550b72ea961fe1c6e4916859.zip |
Merge pull request #268 from djgel/patch-6
Rewrite host or URL to backend
Diffstat (limited to 'config/varnish64')
-rw-r--r-- | config/varnish64/varnish.inc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc index 5dca851c..ec7ef0c4 100644 --- a/config/varnish64/varnish.inc +++ b/config/varnish64/varnish.inc @@ -152,8 +152,17 @@ function varnish_get_url_mappings_txt() { 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'].";"; + + #check rewrite + if ($url['rewritehost']) { + $urlmappings .= "\t\t\tset req.http.host = regsub(req.http.host, ".'"'.$url['directorurl'].'",'.'"'.$url['rewritehost'].'")'.";\n"; + } + if ($url['rewriteurl']) { + $urlmappings .= "\t\t\tset req.url = regsub(req.url, ".'"'.$url['directorurl2'].'",'.'"^'.$url['rewriteurl'].'")'.";\n"; + } + #check failover if ($url['failover'] && $url['failover'] != $url['directorname']){ $tabs=($url['grace']?"\n\t\t\t":""); $urlfailover = "\t\t\tset req.backend = ".$url['failover'].";"; |