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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…