Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm newbie to varnish. I want to to serve all the request from the varnish cache. My backend asked content from CDN and also from other location. Like

My varnish is example.com backend IP 123.123.123.123 backend url request abc.jpg with a link http://web.example.com/api/abc.jpg and some CDN content like https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js

Normally they are not being cached. Served directly to the client browser from their origin location. How to use varnish cache all of them and set a cache lifetime ?

Thanks in advance

question from:https://stackoverflow.com/questions/66054428/varnish-caching-external-content-requested-by-backend-url

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

Varnish Cache uses static backends. You can define the backends explicitly for each external resource you need (web.example.com, cdnjs.cloudflare.com, ...). This has to happen ahead of time and cannot be done on-the-fly.

However, Varnish Enterprise, the commercial version of Varnish offers a module that supports dynamic backends. See https://docs.varnish-software.com/varnish-cache-plus/vmods/goto/ for more info.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...