Run varnishlog against the request and confirm a TCP_HIT when making the second request to the different hostname.  Also confirm you do not see the request hit your backend webserver logfile<div><br></div><div><br><br><div class="gmail_quote">
On Mon, Feb 7, 2011 at 8:49 AM, Chris Johnson <span dir="ltr"><<a href="mailto:johnson@nmr.mgh.harvard.edu">johnson@nmr.mgh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
     Huh.  Well, I think I've done everything everyone said was right.<br>
Here's a snippet of what I have in varnish's default.vcl;<br>
<br>
backend freesurfer {<br>
      .host = "127.0.0.1";<br>
      .port = "8080";<br>
}<br>
<br>
which happens to be the same place the default backend points to<br>
because this is a different virtual host on the same server.<br>
<br>
And in vcl_recv I have;<br>
<br>
    if (req.http.host ~ "^<a href="http://sufer.nmr.mgh.harvard.edu" target="_blank">sufer.nmr.mgh.harvard.edu</a>") {<br>
      set req.http.host = "<a href="http://www.freesurfer.net" target="_blank">www.freesurfer.net</a>";<br>
      set req.backend = freesurfer;<br>
    }<br>
<br>
which referenes my backend declaration and rewrites the header host<br>
name.<br>
<br>
     How do I tell if this is working?  Remember, I'm trying to make<br>
the old virtual host references to <a href="http://sufer.nmr.mgh.harvard.edu" target="_blank">sufer.nmr.mgh.harvard.edu</a> be keyed<br>
on and fetch from the new virtual host <a href="http://www.freesurfer.net" target="_blank">www.freesurfer.net</a> so varnish<br>
doesn't cache everything twice.<br>
<br>
     Varnich didn't complain when I restarted it and seems to be<br>
caching.  I'm just not sure what at this point.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Feb 4, 2011 at 5:17 PM, Chris Johnson<br>
<<a href="mailto:johnson@nmr.mgh.harvard.edu" target="_blank">johnson@nmr.mgh.harvard.edu</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, 4 Feb 2011, Per Buer wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
     if (req.http.host ~ "^<a href="http://www.example.com" target="_blank">www.example.com</a>") {<br>
       set req.backend = foo;<br>
     }<br>
</blockquote>
<br>
    Which goes in vcl_recv and in his case foo is a backend declaration<br>
function that sets up .host and .port for the virtual host I want, yes?<br>
</blockquote>
<br>
Almost. foo is here a declared backend - declared with the keyword<br>
"backend" - <a href="http://www.varnish-cache.org/docs/trunk/tutorial/backend_servers.html" target="_blank">http://www.varnish-cache.org/docs/trunk/tutorial/backend_servers.html</a><br>
<br>
<br>
<br>
<br>
<br>
-- <br>
Per Buer, Varnish Software<br>
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer<br>
Varnish makes websites fly!<br>
Want to learn more about Varnish? <a href="http://www.varnish-software.com/whitepapers" target="_blank">http://www.varnish-software.com/whitepapers</a><br>
<br>
<br>
<br>
</blockquote>
<br></div><div class="im">
-------------------------------------------------------------------------------<br>
Chris Johnson               |Internet: <a href="mailto:johnson@nmr.mgh.harvard.edu" target="_blank">johnson@nmr.mgh.harvard.edu</a><br>
Systems Administrator       |Web:      <a href="http://www.nmr.mgh.harvard.edu/~johnson" target="_blank">http://www.nmr.mgh.harvard.edu/~johnson</a><br>
NMR Center                  |Voice:    617.726.0949<br>
Mass. General Hospital      |FAX:      617.726.7422<br></div>
149 (2301) 13th Street      |Man's a kind of missing link<br>
Charlestown, MA., 02129 USA |fondly thinking he can think.  Piet Hein<div><div></div><div class="h5"><br>
-------------------------------------------------------------------------------<br>
<br>
<br>
The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.<br>
</div></div><br>_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br></blockquote></div><br></div>