Yes it is possible with proxy_cache_bypass directive. You can define query string, cookie or HTTP request header that will allow you to fetch desired resource directly from backend server (bypassing Nginx proxy cache) and save that same response to proxy cache for serving subsequent requests.
Here are a few examples:
location / {
proxy_pass http://backend;
proxy_cache_valid 168h;
# Bypass cache with purgecache=true query string and save new response to proxy cache
proxy_cache_bypass $arg_purgecache;
# Bypass cache with "x-purge-cache: true" request header and save new response to proxy cache
proxy_cache_bypass $http_x_purge_cache;
# Bypass cache with "nocache=true" cookie and save new response to proxy cache
proxy_cache_bypass $cookie_nocache;
}
proxy_cache_bypass will work with as long as cookie, query string or request header don't have empty value or "0".
For example, to purge certain video file with query string, you can simply access https://example.com/some/video.mp4?purgecache=true