aboutsummaryrefslogtreecommitdiffstats
path: root/config/varnish3/varnish.inc
diff options
context:
space:
mode:
authordjgel <marcioc.antao@gmail.com>2012-06-26 15:33:17 -0300
committerdjgel <marcioc.antao@gmail.com>2012-06-26 15:33:17 -0300
commit69da10ca7afe298684f2a4eb0f4a703651007d53 (patch)
tree71748ef910c758e745594cb2bb3bda3dfb2ea171 /config/varnish3/varnish.inc
parent6f442f7d8a0aebad32178b77e18ea2385d12f157 (diff)
downloadpfsense-packages-69da10ca7afe298684f2a4eb0f4a703651007d53.tar.gz
pfsense-packages-69da10ca7afe298684f2a4eb0f4a703651007d53.tar.bz2
pfsense-packages-69da10ca7afe298684f2a4eb0f4a703651007d53.zip
Rewrite URL or host do Backend.
Diffstat (limited to 'config/varnish3/varnish.inc')
-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'].";";