aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-26 15:39:29 -0700
committerMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-26 15:39:29 -0700
commit7c0867308c75d41f5f6c9e00047fc2afc5d59dcb (patch)
treeb338dc101b44d9d5018e83b3f47dd753621e4b18
parent42a9c6500c0d8677550b72ea961fe1c6e4916859 (diff)
parent69da10ca7afe298684f2a4eb0f4a703651007d53 (diff)
downloadpfsense-packages-7c0867308c75d41f5f6c9e00047fc2afc5d59dcb.tar.gz
pfsense-packages-7c0867308c75d41f5f6c9e00047fc2afc5d59dcb.tar.bz2
pfsense-packages-7c0867308c75d41f5f6c9e00047fc2afc5d59dcb.zip
Merge pull request #265 from djgel/patch-3
Rewrite URL or host do Backend.
-rw-r--r--config/varnish3/varnish.inc10
1 files changed, 9 insertions, 1 deletions
diff --git a/config/varnish3/varnish.inc b/config/varnish3/varnish.inc
index 03aadc67..ee6362d5 100644
--- a/config/varnish3/varnish.inc
+++ b/config/varnish3/varnish.inc
@@ -151,8 +151,16 @@ 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 options
+ $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'].";";