Prevent direct access to files but allow download from site

MAXMAXarena nginx-forum at
Wed Mar 11 22:36:10 UTC 2020

Good evening,
I would like to block direct access to files in a folder on my site, but
allow downloading from the site.

Specifically, I want to be able to download a file from the site's html

<a href="/assets/file/test.txt" download=""> Download TXT </a>

But do not allow direct access and download, using the browser or other
tools such as curl or wget.
So block access to the link:

is it possible to obtain such a result?
Thank you

Posted at Nginx Forum:,287297,287297#msg-287297

More information about the nginx mailing list