qoomon / aws-s3-bucket-browser

Single page application to browse AWS S3 bucket content
https://qoomon.github.io/aws-s3-bucket-browser/index.html?bucket=https://s3.amazonaws.com/spacenet-dataset#
MIT License
246 stars 85 forks source link

A way to change {bucket].s3-website.us-east-1. to just the site/domain we are hosting? #45

Closed sithtoast closed 1 year ago

sithtoast commented 1 year ago

This might be out of scope of this project, but i was wondering if there was a way to access the index by going to say... dk.toastednet.org/CM400A instead of http://dk.toastednet.org.s3-website-us-east-1.amazonaws.com/CM400A/#

Would that be a DNS record of some kind?

qoomon commented 1 year ago

Sure you just need to create a CNAME record for dk.toastednet.org pointing to dk.toastednet.org.s3-website-us-east-1.amazonaws.com

qoomon commented 1 year ago

see https://www.freecodecamp.org/news/cjn-how-to-point-your-domain-to-s3-website-bucket/

qoomon commented 1 year ago

if you host your index.html under custom domain you need to set following options in the setup section

const config = {
      // ...
      bucketUrl: 'http://dk.toastednet.org.s3-website-us-east-1.amazonaws.com/CM400A/',
      // ...
      bucketMaskUrl: document.location.origin,
}
sithtoast commented 1 year ago

It's all up on S3. Nothing external from that. Does that change anything?

qoomon commented 1 year ago

no, just set the config as described above.

qoomon commented 1 year ago

and adjust you CORS policy to http://dk.toastednet.org

sithtoast commented 1 year ago

I now get a blank page. It won't let me set a CNAME without removing the A record that Amazon set when I created the bucket.

qoomon commented 1 year ago

you forgot to quote the value bucketUrl: 'http://dk.toastednet.org.s3-website-us-east-1.amazonaws.com/CM400A/',

qoomon commented 1 year ago

http://dk.toastednet.org/CM400A/ is already working so no CNAME needed

sithtoast commented 1 year ago

Coming in clutch. Thanks!!!

qoomon commented 1 year ago

It's working now. btw I fixed the integrity check for zero-md script in version 1.11.5