changing backend and host header not working
Carlos Abalde
carlos.abalde at gmail.com
Fri Aug 22 09:28:03 CEST 2014
On 22 Aug 2014, at 09:18, יריב הראל <YARIV-H at yit.co.il> wrote:
> Selecting backend and normalizing host header :
>
> sub vcl_recv {
> if (req.http.host == "source-qa.example.co.il" || "source-qa-pp.example.co.il" || "qa.example.co.il") {
> set req.http.host = "qa.example.co.il";
> set req.backend = example_qa;
> }
> }
>
> sub vcl_recv {
> if (req.http.host == "source-qa-test.co.il" || "qa-test.co.il" ) {
> set req.http.host = "qa-test.ynet.co.il";
> set req.backend = test_other_sites_qa;
> }
> }
>
> Now the problem is that when I send a request with one of the host headers "source-qa.example.co.il" || "source-qa-pp.example.co.il" || "qa.example.co.il"
>
> The request is always sent to test_other_sites_qa which is the second backend and not the correct one .
Hi,
It seems the second vcl_recv subroutine is matching for every request. You should write:
if (req.http.host == "source-qa.example.co.il" || req.http.host == "source-qa-pp.example.co.il" || req.http.host == "qa.example.co.il") {
...
if (req.http.host == "source-qa-test.co.il" || req.http.host = "qa-test.co.il” ) {
...
Cheers,
—
Carlos Abalde.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140822/01fd3553/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140822/01fd3553/attachment-0001.pgp>
More information about the varnish-misc
mailing list