aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/varnish3/varnish_lb_directors.xml22
-rw-r--r--config/varnish64/varnish.inc11
-rw-r--r--config/varnish64/varnish_lb_directors.xml24
3 files changed, 55 insertions, 2 deletions
diff --git a/config/varnish3/varnish_lb_directors.xml b/config/varnish3/varnish_lb_directors.xml
index 994320f3..345dae51 100644
--- a/config/varnish3/varnish_lb_directors.xml
+++ b/config/varnish3/varnish_lb_directors.xml
@@ -111,6 +111,14 @@
<fielddescr>URL</fielddescr>
<fieldname>directorurl2</fieldname>
</columnitem>
+ <columnitem>
+ <fielddescr>Rewrite Host</fielddescr>
+ <fieldname>rewritehost</fieldname>
+ </columnitem>
+ <columnitem>
+ <fielddescr>Rewrite url</fielddescr>
+ <fieldname>rewriteurl</fieldname>
+ </columnitem>
<columnitem>
<fielddescr>Type</fielddescr>
@@ -168,6 +176,20 @@
<type>input</type>
<size>40</size>
</field>
+ <field>
+ <fielddescr>Rewrite Host</fielddescr>
+ <fieldname>rewritehost</fieldname>
+ <description>Hint image.mysite.com</description>
+ <type>input</type>
+ <size>40</size>
+ </field>
+ <field>
+ <fielddescr>Rewrite URL</fielddescr>
+ <fieldname>rewriteurl</fieldname>
+ <description>Hint /images</description>
+ <type>input</type>
+ <size>40</size>
+ </field>
<field>
<fielddescr>Req Grace</fielddescr>
<fieldname>grace</fieldname>
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'].";";
diff --git a/config/varnish64/varnish_lb_directors.xml b/config/varnish64/varnish_lb_directors.xml
index 994320f3..4c46414e 100644
--- a/config/varnish64/varnish_lb_directors.xml
+++ b/config/varnish64/varnish_lb_directors.xml
@@ -111,7 +111,14 @@
<fielddescr>URL</fielddescr>
<fieldname>directorurl2</fieldname>
</columnitem>
-
+ <columnitem>
+ <fielddescr>Rewrite Host</fielddescr>
+ <fieldname>rewritehost</fieldname>
+ </columnitem>
+ <columnitem>
+ <fielddescr>Rewrite url</fielddescr>
+ <fieldname>rewriteurl</fieldname>
+ </columnitem>
<columnitem>
<fielddescr>Type</fielddescr>
<fieldname>directortype</fieldname>
@@ -168,6 +175,21 @@
<type>input</type>
<size>40</size>
</field>
+ <field>
+ <fielddescr>Rewrite Host</fielddescr>
+ <fieldname>rewritehost</fieldname>
+ <description>Hint image.mysite.com</description>
+ <type>input</type>
+ <size>40</size>
+ </field>
+ <field>
+ <fielddescr>Rewrite URL</fielddescr>
+ <fieldname>rewriteurl</fieldname>
+ <description>Hint /images</description>
+ <type>input</type>
+ <size>40</size>
+ </field>
+
<field>
<fielddescr>Req Grace</fielddescr>
<fieldname>grace</fieldname>