Question: prevent website files from being downloaded from direct URL

Question

prevent website files from being downloaded from direct URL

Answers 1
Added at 2017-11-07 21:11
Tags
Question

I have a site in Wordpress that has a PDF link for download that is currently on a password protected page. I am wondering how I can prevent that PDF from being downloaded if someone happens to get the direct file path url for that PDF. Is there maybe a plugin that would help? The site is on AWS so I can't change the .htaccess file as I've seen most people suggest.

Answers to

prevent website files from being downloaded from direct URL

nr: #1 dodano: 2017-11-07 21:11

The standard approach with AWS is to host your files on S3 and use S3 PreSigned URLs with an expiration.

From your protected by password pages, generated presigned urls in place of the regular download link. Then protect your S3 bucket by making it NOT public. The presigned url will be required to download the file.

A Google search will turn up lots of examples with source code on how to do this. Very easy to do.

Creating a presigned request

Source Show
◀ Wstecz