How purge all cached pages on a v4 varnish server ? I found this in documentation but how apply the vcl_recv command ?
return(purge) will only purge the hash associated with the request object as it currently stands. What you're describing is a full cache clear. The easiest way to do that is simply to restart Varnish. Failing that, you can also use
varnishadm to ban out all URLs, or write a bit of VCL (see https://www.varnish-cache.org/docs/trunk/users-guide/purging.html) to allow you to do the cache clear via a Web request.