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

CloudFront support #14

Closed BelyashUa closed 3 years ago

BelyashUa commented 3 years ago

Hi and thank you for this project.

I have set up it on S3 and it works. But I want to use CloudFront. I have configured CF as you discribe it in README.md.

When I open CF url it shows me an error: List bucket response does not contain <ListBucketResult> tag!

According to message in footer its tries to use CF url instead of real bucket url. image And the same situation when I use my domain from route 53.

Maybe I did somting wrong..

qoomon commented 3 years ago

I see, this is because the script tries to determine bucket url by getting it from index.html url.

I think easiest solution is to provide a config variabel to override this behavior.

BelyashUa commented 3 years ago

Thank you for reply. What config variabel shell I provide ?

I have tested it with 'bucketUrl' in the index.html

image

but it does not help.

Also with this configuration I had an error when opend bucked url directly image

qoomon commented 3 years ago

hi, first of all bucketUrl is the right config variable. I think your bucket url is wrong you need to provide bucket location like this https://s3.${region}.amazonaws.com/.... However I don't understand why you get this reference error, I never get it. I assume its because of an evaluation order problem. I'll try to add defer attribute to config script. Give me a minute.

qoomon commented 3 years ago

Oh defer attribute is not valid for inline scripts. Do you get the reference error all the time?

qoomon commented 3 years ago

Is my example working on your machine? https://qoomon.github.io/aws-s3-bucket-browser/index.html?bucket=https://s3.eu-west-1.amazonaws.com/data.openspending.org

qoomon commented 3 years ago

this example set bucketUrl by request parameter otherwise it should work the same way as if you set bucketUrl statically within the config object.

BelyashUa commented 3 years ago

Do you get the reference error all the time? no, just in case when I set up bucketUrl in the index.html. Otherwise, it works fine.

BelyashUa commented 3 years ago

Is my example working on your machine? https://qoomon.github.io/aws-s3-bucket-browser/index.html?bucket=https://s3.eu-west-1.amazonaws.com/data.openspending.org

I can open your site, but when I passed my S3 URL have an error image

This is my S3 URL https://s3.amazonaws.com/d2dpqoe4o8lq65.cloudfront.net/

BelyashUa commented 3 years ago

Is my example working on your machine? https://qoomon.github.io/aws-s3-bucket-browser/index.html?bucket=https://s3.eu-west-1.amazonaws.com/data.openspending.org

I can open your site, but when I passed my S3 URL have an error image

This is my S3 URL https://s3.amazonaws.com/d2dpqoe4o8lq65.cloudfront.net/

I fixed this error in the CORS setting, but still, have an error image

qoomon commented 3 years ago

you bucket url end in a file .../caarefirsl.txt that seems wrong.

qoomon commented 3 years ago

I get a bucket not found error if I try to reach https://s3.amazonaws.com/d2dpqoe4o8lq65.cloudfront.net/

qoomon commented 3 years ago

the region is missing again in your bucket url https://s3.amazonaws.com/d2dpqoe4o8lq65.cloudfront.net/

BelyashUa commented 3 years ago

I did some testing and create a new bucket. Now your example is working for me: https://qoomon.github.io/aws-s3-bucket-browser/index.html?bucket=https://s3.us-east-1.amazonaws.com/gttbdownloads.com

But from CF it still tries to use CF URL.

qoomon commented 3 years ago

for me following index.html works as expected. I set your bucket url as bucketUrl within config section see index.html.zip

BelyashUa commented 3 years ago

I checked your index.html and finally its start to work. For CF with Route 53 it also works.

Thanks for the help !

qoomon commented 3 years ago

you're welcome.