Using varnish to cache remote content

Stewart Robinson stewsnooze at
Wed Mar 30 08:40:49 CEST 2011


You can only cache items where the DNS record for those sites points at the server/infrastructure where you are running Varnish.

You could do something crazy like have referenced in your HTML pages which is configured in Varnish to use as a backend. Personally I think this is a bit strange but it is possible.

You need to think about why you are caching external stuff in Varnish and whether you are allowed to?


On 30 Mar 2011, at 07:35, Ronny Östman wrote:

> Hello!
> 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 - Domain:
> GET main.css - Domain:
> GET hello.jpg - Domain:
> GET anypicture.png - Domain:
> GET foo.js - Domain:
> 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?
> Thanks!
> Regards,
> Ronny
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list