In order to invalidate the cache, I'm encoding an url the following way:
$clean_url = base64_encode( $url );
http://url_of_the_varnish_host_to_clean/clean/url?v=$clean_url
I would like to catch this url to clean and decode it in my vcl file. I catch the request this way:
if (req.url ~ "^/clean/url?v=")
But I have no idea how to catch the parameter and decode it.
You will at very least need vmod_digest which provides digest.base64_decode
function.
Also, your regex is a bit wrong, should be:
if (req.url ~ "^/clean/url\?v=")
That said, why does your invalidation logic has to be so complex? Why not do it standard way - i.e. check against matches of purger IP against defined ACL and invalidate the URL of PURGE request (not parameter).