Prevent direct access to files but allow download from site

Ralph Seichter abbot at monksofcool.net
Wed Mar 11 22:57:03 UTC 2020


* MAXMAXarena:

> I want to be able to download a file from the site's html tag [...]
> But do not allow direct access and download, using the browser or
> other tools such as curl or wget.

Public access and restricted access are mutually exclusive. It also
makes nearly no difference what utility is used to access a URL pointing
to the text file you gave as an example, because they'll all send a HTTP
GET request, which is what the web server expects. Attempting to limit
access based on a User-Agent header or similar, to identify the client
type, is easily circumvented.

-Ralph


More information about the nginx mailing list