Basic HTTP Auth for AWS S3 hosted site, similar to .htaccess
Asked Answered
C

4

10

I have a static HTML site hosted on Amazon S3.

Ideally I want to be able to limit access to a staging site in the same way as with a .htaccess/.htpasswd file.

I understand that bucket policies can be used to limit access (I have already used one to make the bucket contents publicly accessible), but I can't see any way to limit access.

In an ideal situation I would like an auth prompt - but appending a token to a URL would also work.

Cassidycassie answered 15/11, 2012 at 13:42 Comment(2)
Possible duplicate of Does Amazon S3 support HTTP request with basic authenticationJasper
I would take a look at the answer on this SO post https://mcmap.net/q/236248/-does-amazon-s3-support-http-request-with-basic-authenticationJasper
C
5

Yes, this is possible: checkout s3auth (no affiliation).

Chignon answered 17/4, 2013 at 13:33 Comment(0)
A
2

I think the AWS SDK for Javascript is what you're looking for. It allows you to login with Facebook, Google or Amazon. Here's another resource using AWS login.

Amabelle answered 7/12, 2015 at 23:3 Comment(0)
H
0

Could you use the standard AWS token keys for auth? You would need some JavaScript or similar to apply the key to all assets/internal links within the page which introduces a slight delay to loading but it should work in theory.

Hayner answered 15/11, 2012 at 17:19 Comment(0)
C
0

You can try manipulating the AWS ACL, but otherwise, you will need to clone it to a repo on a private server or something. From reading the description, it seems like S3's ability to serve static pages is pretty limited and is designed more as a convenience then a functional server.

Cosenza answered 15/11, 2012 at 17:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.