Rewrite domain and keep subdomain

Matt . yamakasi.014 at gmail.com
Mon Aug 24 09:05:50 CEST 2015


Hi Paul,

Thanks,that looks good. But what if I don't know which subdomain I
will receive ? The domains are known but the subdomains may differ.

I was thinking about distracting it from FIRST.tld and after that
attaching it again to the + SECOND.tld

Cheers,

Matt



2015-08-24 8:37 GMT+02:00 Paul Armstrong <varnish-cache at otoh.org>:
> At 2015-08-24T01:41+0200, Matt . wrote:
>> I'm figuring out how I can rewrite a domain in a req.http.Host
>>
>> Like I type in my  addressbar: subdomain.myFIRSTdomain.tld
>>
>> Where Varnish needs to catch this using req.http.Host filter out the
>> domainname and make req.http.Host actually:
>>
>> subdomain.mySECONDdomain.tld
>>
>> I'm figuring out how to do so, but I can't find the right way/docs.
>
> Putting the following in vcl_recv should do it:
> set req.http.Host = regsub(req.http.Host, "subdomain.myFIRSTdomain.tld",
> "subdomain.mySECONDdomain.tld”);
>
> Paul



More information about the varnish-misc mailing list