Changing the fetch for virtual hosts.

Chris Johnson johnson at nmr.mgh.harvard.edu
Fri Feb 4 17:17:30 CET 2011


On Fri, 4 Feb 2011, Per Buer wrote:

> On Fri, Feb 4, 2011 at 3:24 PM, Chris Johnson
> <johnson at nmr.mgh.harvard.edu> wrote:
>>>
>>> Not unless you explicitly set the backend later. The only thing you do
>>> here is to set a new Host: header, which makes sense, btw.
>>
>>     Not clear on what you mean by that first sentence.  Can you
>> elaborate?
>
> Sure. You need to set what backend your using something like this at some point:
>
>       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?
>
> If you already have set req.http.host before reaching this things will be fine.
>
>>     I was looking through the example snippets to see if there was
>> anything to prevent redundant caching.  I've found two exampes that
>> look interesting.  They are
>>
>>     o  Redirecting the browser to another hostname
>>
>>     o  Using static regular expressions to munge an incoming HTTP
>>        request to become something very different. Very useful if
>>        you want to apply the same varnish config to all sites on
>>        a server hosting many, many small sites
>>
>>     The last sounds closer to what I'm trying to do to prevent
>> redundant caching.
>>
>>     Has anyone had/solved this problem?
>
> I think your approach is fine.
>
>
> -- 
> 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      |God stand between you and harm in all the empty
Charlestown, MA., 02129 USA |places where you must walk. old Egyptian blessing
--------------------------------------------------------------------------------


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.


More information about the varnish-misc mailing list