Protecting Cached Files Direct Access

cache

#1

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.


#2

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.


#3

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


#4

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.


#5

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
BR