Rewrite foo.com to bla.com/$1 ?

Matt . yamakasi.014 at gmail.com
Wed Jan 7 15:04:15 CET 2015


Hi,

Thanks, I was just not sure anymore, too long ago.

But you say that the full URL consists of req.http.host and req.url, does
that really matter in this case as req.url stays untouched ?

2015-01-07 14:03 GMT+01:00 Per Buer <perbu at varnish-software.com>:

> On Wed, Jan 7, 2015 at 1:55 PM, Matt . <yamakasi.014 at gmail.com> wrote:
>
>> Hi All,
>>
>> In the past I tested some scripts on on varnish for rewriting a
>> domainname.
>>
>> My idea would be foo.com/* to bla.com/$1
>>
>> Can I accomplish this with just something like:
>>
>> if (req.http.host ~ "foo.com") {
>> set req.http.host = "bla.com/$1";
>> }
>>
>
> Unless I missed something essential you could just do
>
> if (req.http.host ~ "foo.com") {
>       set req.http.host = "bar.com";
> }
>
> req.url will stay untouched. Remember that the full URL consists of
> req.http.host and req.url.
>
> --
> *Per Buer*
> CTO | Varnish Software AS
> Cell: +47 95839117
> We Make Websites Fly!
> www.varnish-software.com
> [image: Register now]
> <http://info.varnish-software.com/varnish-summits-autumn-2014-registration>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20150107/de519161/attachment.html>


More information about the varnish-misc mailing list