Skip to content

sgtFloyd/s3-autoindex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

s3-autoindex

Static website to generate directory listing for S3 buckets.

Example directory listing generated by s3-autoindex

Usage

Clone the repository and edit config.js, configuring it with your bucket.

  • Set window.S3_BUCKET_URL to bucket's REST endpoint.
  • Alternatively, set window.SECRET_BUCKET_URL to your AES-encrypted REST endpoint. Doing so will obfuscate your public S3 url and password protect your directory listing. An encrypt function is available in js/encryption.js for generating encrypted URLs.

Note: The S3 REST endpoint used differs from S3's website endpoint. For more details, see: Website Rest EndpointDiff.

S3 Bucket Permissions

You must setup the S3 website bucket to allow public read access.

  • Grant Everyone the List and View permissions:

  • Assign the following Bucket Policy:

{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Sid": "AllowPublicRead",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::{your-bucket-name}/*"
        }
    ]
}
  • Assign the following CORS Configuration:
<CORSConfiguration>
 <CORSRule>
   <AllowedOrigin>*</AllowedOrigin>
   <AllowedMethod>GET</AllowedMethod>
   <AllowedHeader>*</AllowedHeader>
 </CORSRule>
</CORSConfiguration>

About

Static website to show a directory listing for an S3 bucket

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published