I just started reading about Varnish and am considering using it as a frontend to my webservers. I have multiple domains on my webserver that fetch the same content when the same query strings are used. So lets say one client visits:
http://domain1.com/script.php?string1=abc&string2=123
And later on, someone else visits:
http://domain2.com/script.php?string1=abc&string2=123
Would Varnish cache the results from the first visit and use that for the second client? Thanks!
EDIT: After some more reading, it sounds like the following may work:
sub vcl_hash {
set req.hash += req.url;
return (hash);
}
So instead of added the http.host variable to the hash, it ignores it.
You can configure it to do so, sort-of. By default, it won't (and shouldn't).
From Varnish FAQ/HowDoI
I have 3 domains on my VM, I am using Nginx and Varnish, currently I am on a pre prod configuration, here what I am doing :
I am using Nginx:80 like a proxy IF the domain needs Varnish, if not, I use FastCGI stuff. In this exemple, the not Varnish sites are not concerned by Varnish. It looks stupid but it woks ;-) and none of my customers complain (yet....).