<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On 22 Aug 2014, at 09:18, יריב הראל <<a href="mailto:YARIV-H@yit.co.il">YARIV-H@yit.co.il</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Selecting backend and normalizing host header :</span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">sub vcl_recv {<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">        if (req.http.host == "<a href="http://source-qa.example.co.il/" style="color: purple; text-decoration: underline;">source-qa.example.co.il</a>" || "<a href="http://source-qa-pp.example.co.il/" style="color: purple; text-decoration: underline;">source-qa-pp.example.co.il</a>" || "<a href="http://qa.example.co.il/" style="color: purple; text-decoration: underline;">qa.example.co.il</a>") {<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">                set req.http.host = "<a href="http://qa.example.co.il/" style="color: purple; text-decoration: underline;">qa.example.co.il</a>";<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">                set req.backend = example_qa;<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">}<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">}<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">sub vcl_recv {</span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">                if (req.http.host == "<a href="http://source-qa-test.co.il/" style="color: purple; text-decoration: underline;">source-qa-test.co.il</a>" || "<a href="http://qa-test.co.il/" style="color: purple; text-decoration: underline;">qa-test.co.il</a>" ) {<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">                                set req.http.host = "<a href="http://qa-test.ynet.co.il/" style="color: purple; text-decoration: underline;">qa-test.ynet.co.il</a>";<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">                                set req.backend = test_other_sites_qa;<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">}<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">}<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">Now the problem is that  when I send a request with one of the host headers  "<a href="http://source-qa.example.co.il/" style="color: purple; text-decoration: underline;">source-qa.example.co.il</a>" || "<a href="http://source-qa-pp.example.co.il/" style="color: purple; text-decoration: underline;">source-qa-pp.example.co.il</a>" || "<a href="http://qa.example.co.il/" style="color: purple; text-decoration: underline;">qa.example.co.il</a>"<o:p></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">The request is always sent to  test_other_sites_qa which is the second backend and not the correct one .<o:p></o:p></div></div></div></blockquote><br></div><div>Hi,</div><div><br></div><div>It seems the second vcl_recv subroutine is matching for every request. You should write:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">  </span><span style="font-family: Calibri, sans-serif; font-size: 11pt;">if (req.http.host == "</span><a href="http://source-qa.example.co.il/" style="font-family: Calibri, sans-serif; font-size: 11pt; color: purple;">source-qa.example.co.il</a><span style="font-family: Calibri, sans-serif; font-size: 11pt;">" || </span><span style="font-family: Calibri, sans-serif; font-size: 15px;">req.http.host == </span><span style="font-family: Calibri, sans-serif; font-size: 11pt;">"</span><a href="http://source-qa-pp.example.co.il/" style="font-family: Calibri, sans-serif; font-size: 11pt; color: purple;">source-qa-pp.example.co.il</a><span style="font-family: Calibri, sans-serif; font-size: 11pt;">" || </span><span style="font-family: Calibri, sans-serif; font-size: 15px;">req.http.host == </span><span style="font-family: Calibri, sans-serif; font-size: 11pt;">"</span><a href="http://qa.example.co.il/" style="font-family: Calibri, sans-serif; font-size: 11pt; color: purple;">qa.example.co.il</a><span style="font-family: Calibri, sans-serif; font-size: 11pt;">") {</span></div><div><span style="font-family: Calibri, sans-serif; font-size: 11pt;"><span class="Apple-tab-span" style="white-space:pre">             </span>...</span></div><div><span style="font-family: Calibri, sans-serif; font-size: 11pt;"><br></span></div><div><span class="Apple-tab-span" style="white-space:pre">      </span>if <span style="font-family: Calibri, sans-serif; font-size: 11pt;">(req.http.host == "</span><a href="http://source-qa-test.co.il/" style="font-family: Calibri, sans-serif; font-size: 11pt; color: purple;">source-qa-test.co.il</a><span style="font-family: Calibri, sans-serif; font-size: 11pt;">" || </span><span style="font-family: Calibri, sans-serif; font-size: 15px;">req.http.host = </span><span style="font-family: Calibri, sans-serif; font-size: 11pt;">"</span><a href="http://qa-test.co.il/" style="font-family: Calibri, sans-serif; font-size: 11pt; color: purple;">qa-test.co.il</a><font face="Calibri, sans-serif"><span style="font-size: 15px;">”</span><span style="font-size: 11pt;"> ) {</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 11pt;"><span class="Apple-tab-span" style="white-space:pre">             </span>...</span></font></div><div><span style="font-family: Calibri, sans-serif; font-size: 11pt;"><br></span></div>Cheers,<div><br></div><div>—</div><div>Carlos Abalde.</div></body></html>