Guidance and Advice On How To Setup HTTP Authentication For File Download Webpage WordPress AWS EC2 Ubuntu

I have a wordpress site running on AWS EC2 Ubuntu. I don't know how to technically describe this but here it goes:
I need a page URL that when you go to the URL it will Automatically allow someone to download a CSV file after HTTP Authentication.

I have seen and tried tutorials for setting up a HTTP Authentication for my Admin Sign in page. But I can't find any help on setting up a single page.  I am also up to suggestions on how to setup this HTTP Authentication on AWS S3 Bucket. I hope this makes sense. Thank you for the help.
Dustin StanleyEntrepreneurAsked:
Who is Participating?
The <files> directive can be placed inside "directory" and can refer to a single file by name.
This should work.

<Location "/demo">
	<Files "cat.html">
		AuthBasicFake someuser somepass

Open in new window

Apache docs of the <files> directive

For S3, you can only do that by using a CDN in front of S3.
With many CDN services (Akamai, Edgecast, Fastly ...) it is a piece of cake.  

With Cloudfront, you have to inject a Lambda@Edge response. An example is to be found here.

Or, adapt this AWS example. You have to check for the existence of a specific header with a specific value, and return a 401 error on failure.

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l

Open in new window

The value is the user & password separated by a colon and base64 encoded.

An example of a full 401 response.
Dave BaldwinFixer of ProblemsCommented:
I have never heard of using HTTP Authentication for a single file, just directories.
Dustin StanleyEntrepreneurAuthor Commented:
I thank you all for the help. Just to clarify what my developer has told me is I could use something like:

Open in new window

to upload my file automatically.

The answers above...would this be the easiest route? Thanks.
Dustin StanleyEntrepreneurAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.