Changing the fetch for virtual hosts.
Adam Denenberg
adam at dberg.org
Mon Feb 7 16:39:55 CET 2011
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
On Mon, Feb 7, 2011 at 8:49 AM, Chris Johnson
<johnson at nmr.mgh.harvard.edu>wrote:
> Huh. Well, I think I've done everything everyone said was right.
> Here's a snippet of what I have in varnish's default.vcl;
>
> backend freesurfer {
> .host = "127.0.0.1";
> .port = "8080";
> }
>
> which happens to be the same place the default backend points to
> because this is a different virtual host on the same server.
>
> And in vcl_recv I have;
>
> if (req.http.host ~ "^sufer.nmr.mgh.harvard.edu") {
> set req.http.host = "www.freesurfer.net";
> set req.backend = freesurfer;
> }
>
> which referenes my backend declaration and rewrites the header host
> name.
>
> How do I tell if this is working? Remember, I'm trying to make
> the old virtual host references to sufer.nmr.mgh.harvard.edu be keyed
> on and fetch from the new virtual host www.freesurfer.net so varnish
> doesn't cache everything twice.
>
> Varnich didn't complain when I restarted it and seems to be
> caching. I'm just not sure what at this point.
>
>
> On Fri, Feb 4, 2011 at 5:17 PM, Chris Johnson
>> <johnson at nmr.mgh.harvard.edu> wrote:
>>
>>> On Fri, 4 Feb 2011, Per Buer wrote:
>>>
>>>>
>>>> if (req.http.host ~ "^www.example.com") {
>>>> set req.backend = foo;
>>>> }
>>>>
>>>
>>> Which goes in vcl_recv and in his case foo is a backend declaration
>>> function that sets up .host and .port for the virtual host I want, yes?
>>>
>>
>> Almost. foo is here a declared backend - declared with the keyword
>> "backend" -
>> http://www.varnish-cache.org/docs/trunk/tutorial/backend_servers.html
>>
>>
>>
>>
>>
>> --
>> Per Buer, Varnish Software
>> Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
>> Varnish makes websites fly!
>> Want to learn more about Varnish?
>> http://www.varnish-software.com/whitepapers
>>
>>
>>
>>
>
> -------------------------------------------------------------------------------
> Chris Johnson |Internet: johnson at nmr.mgh.harvard.edu
> Systems Administrator |Web:
> http://www.nmr.mgh.harvard.edu/~johnson
> NMR Center |Voice: 617.726.0949
> Mass. General Hospital |FAX: 617.726.7422
> 149 (2301) 13th Street |Man's a kind of missing link
> Charlestown, MA., 02129 USA |fondly thinking he can think. Piet Hein
>
>
> -------------------------------------------------------------------------------
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110207/cdb68365/attachment-0003.html>
More information about the varnish-misc
mailing list