aboutsummaryrefslogtreecommitdiffstats
path: root/config/varnish64
diff options
context:
space:
mode:
authordjgel <marcioc.antao@gmail.com>2012-06-26 15:46:17 -0300
committerdjgel <marcioc.antao@gmail.com>2012-06-26 15:46:17 -0300
commit3577412e57c973cd7870a8f55592a93288132a2e (patch)
tree616b65026b56497b71d242741ca38bdea5731b83 /config/varnish64
parentafa00d51a7c7dad87ea28a3f9f6186b69bd6c47d (diff)
downloadpfsense-packages-3577412e57c973cd7870a8f55592a93288132a2e.tar.gz
pfsense-packages-3577412e57c973cd7870a8f55592a93288132a2e.tar.bz2
pfsense-packages-3577412e57c973cd7870a8f55592a93288132a2e.zip
Rewrite host or URL to backend
Diffstat (limited to 'config/varnish64')
-rw-r--r--config/varnish64/varnish.inc11
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'].";";