Using varnish to cache remote content
kbrownfield at google.com
Wed Mar 30 08:52:03 CEST 2011
Yes, what you describe is impossible.
Since all of these requests are handled on the client/browser side, you
can't effect them. The only way would be to either A) configure the user to
proxy through your varnish for specific domains (ugly), or B) filter the
user's DNS and replace flickr.com etc with the IP of your varnish cache
(even uglier). Neither is possible with general internet traffic.
Not a Varnish thing, but in theory you could modify your backends to rewrite
external URLs that they emit as
http://flickr.com/real_file) and then have Varnish perform cache magick on
that rewritten URL. But start talking SSL and it all goes sideways. And
this assumes you wanted only to proxy external URLs that your site is
If there's a glimmer of possibility, it's a really ugly glimmer. ;-)
On Tue, Mar 29, 2011 at 23:35, Ronny Östman <ronny.ostman at apberget.se>wrote:
> This might be a stupid question since I've searched alot and haven't really
> found the answer..
> Anyway, I have a varnish set up caching requests to my backend the way I
> want it to and it works great
> for all content that my backend provides.
> The problem I am having is caching content from remote sources.. I'm not
> sure if this is really possible since
> the request may not go through varnish.. i guess?
> To further illustrate my question, here's an example of how it might look:
> GET mydomain.com - Domain: mydomain.com
> GET main.css - Domain: mydomain.com
> GET hello.jpg - Domain: static.mydomain.com
> GET anypicture.png - Domain: flickr.com
> GET foo.js - Domain: foo.com
> In this example, is it possible to have my varnish cache those "remote"
> requests as well? I can set up backends
> for those remote domains and force varnish to use them instead of my own
> backend but I can't seem to find a
> way to have varnish do this "dynamically". The requests doesnt seem to go
> through my varnish according to
> varnishlog and this makes it hard to set backend depending on host.
> Am I trying to accomplish something impossible here?
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the varnish-misc