Prevent direct access to files but allow download from site

J.R. themadbeaker at
Thu Mar 12 16:00:48 UTC 2020

Without you being more specific on HOW you want to block direct
downloads and how extreme you want to prevent it, then it's all just a
wild guess what kind of solution you want.

>From the example link you gave for stackoverflow, it sounds like you
just want to prevent hotlinking (i.e. downloading without the client
sending a proper referral URL)...

The nginx equivalent of the apache blocking via referral can be found:

You just set the 'valid_referers' you want, then create a simple 'if'
statement in a location to return a '403 forbidden'...

if ($invalid_referer) { return 403; }

More information about the nginx mailing list