Hi guys,<div><br></div><div>I am trying to restrict some access to my Varnish. I want to accept only requests for <a href="http://domain1.com">domain1.com</a> and <a href="http://domain2.com">domain2.com</a>, but deny access to server's IP address. This is my vcl_recv:</div>
<div><br></div><div>if (req.http.host ~ ".*domain1.*")</div><div><div>{</div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>set req.backend = domain1;</div>
</div></blockquote><div><div>}</div><div>elseif (req.http.host ~ ".*domain2.*")</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><div>{</div></div><blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
<div><div>set req.backend = domain2;</div></div></blockquote><div><div>}</div></div><div>else</div><div>{</div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>
<div>error 405 "Sorry!";</div></div></blockquote><div><div>}</div></div><div><br></div><div>Am I doing the right way? Do you have any suggestion?</div><div><br></div><div>Thank you,</div><div>Roberto.</div>