Problem to solve : to implement gated content on documents or (assets) tagged with a specific tag,if a tag is used and a self generated cookie in not present i have to redirect the user to a form to complete and on the successful submission of the form a cookie will be created. then the user can download the asset
the HTML spec's download attribute to a elements. When used, this attribute signifies that the resource it points to should be downloaded by the browser rather than navigating to it. That means response header contain content-type as download that's why the filter is not working.
You can remove the download attribute and check the url and if valid send response as download.