Protecting Cached Files Direct Access


How Can I protect and deny direct access to cached files (not images)? and only allow from my download page?

If visitor entered URL directly to the browser I need to deny or redirect it to a download page.
I need both protection and cache.


this generally isn’t possible. Even if you used hotlink protection for non-images, someone could just open up their browser’s devtools and see the entire file there, without directly entering it into their browser URL bar.


You can use signed requests to make sure a user/visitor is authenticated to access files.

1 Like

Thanks @cscharff for the idea, but it seems more complicated that I require. I dn;t need to authenticate users, just ensure that they use my download page.

I think I can use “referral” in the request header and check it with worker, if it is not my download page or empty, then I should redirect/ deny access. Is that correct?

Any basic worker script to get started with?
Thanks in advanced.


Thanks for All members, it works for me now. I used workers with the script of HotLinking and made a little changes. It works like a charm

closed #6

This topic was automatically closed after 30 days. New replies are no longer allowed.