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

bucket directory listing is not working #15

Closed vijaymentor closed 3 years ago

vijaymentor commented 3 years ago

in index.html file after replaced the following line also

bucketUrl: 'http://bucket-name.s3-website-eu-west-1.amazonaws.com'

please help on where i am missing it.

listbucketresult-error

qoomon commented 3 years ago

I need some more information. The bucket url 'http://bucket-name.s3-website-eu-west-1.amazonaws.com' seems to be wrong I got

Code: IncorrectEndpoint
Message: The specified bucket exists in another region. Please direct requests to the specified endpoint.
Endpoint: bucket-name.s3-website-us-east-1.amazonaws.com

further more bucket url format should be like 'https://s3.eu-west-1.amazonaws.com/data.openspending.org' in your case probably 'https://s3.us-east-1.amazonaws.com/bucket-name'

qoomon commented 3 years ago

the bucketUrl should return an xml document with <ListBucketResult> as root element, see 'https://s3.eu-west-1.amazonaws.com/data.openspending.org'

vijaymentor commented 3 years ago

actual bucket name is http://dgenv-website1.s3-website-eu-west-1.amazonaws.com/ (this is the name i got when i enabled the static website hosting in s3 bucket properties).I have attached the static website dns name screenshot also from s3 bucket properties.

here i have attached the index.html file in index.zip file format. please help me what i am doing wrong here

static-website-name index.zip

qoomon commented 3 years ago

change bucketUrl to https://s3.eu-west-1.amazonaws.com/dgenv-website

vijaymentor commented 3 years ago

bucket name is dgenv-website1 so shall i put like below

https://s3.eu-west-1.amazonaws.com/dgenv-website1

?

qoomon commented 3 years ago

yes that would work.

I also added a feature to handle those website se3 bucket addresses out of the box. Just leave bucketUrl undefined and it should work as well.

Try grep the latest version.

vijaymentor commented 3 years ago

Now this below s3 bucket url is working

http://dgenv-website.s3-website-eu-west-1.amazonaws.com/

However if i access actual domain name https://env.dataplatform.tech.ec.europa.eu/ then always calling wrong url

Bucket: https://s3.eu-west-1.amazonaws.com/dgenv-website

can you help me on this

qoomon commented 3 years ago

this is because of your CORS setup, see CORS Configuration in README

qoomon commented 3 years ago

set AllowedOrigins to your hosting domain in your case https://env.dataplatform.tech.ec.europa.eu

vijaymentor commented 3 years ago

[ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET" ], "AllowedOrigins": [ "https://env.dataplatform.tech.ec.europa.eu/" ], "ExposeHeaders": [ "x-amz-server-side-encryption", "x-amz-request-id", "x-amz-id-2" ], "MaxAgeSeconds": 3000 } ]

I have implemented the above CORS rule in the s3 bucket permission.Still whenever i access the https://env.dataplatform.tech.ec.europa.eu/ and it is trying to access wrong S3 bucket below url

wrong url - Bucket: https://s3.eu-west-1.amazonaws.com/dgenv-website

correct url - http://dgenv-website.s3-website-eu-west-1.amazonaws.com

i think index.html is still working old S3 bucket name format.Can you please check and advise me

qoomon commented 3 years ago

'https://s3.eu-west-1.amazonaws.com/dgenv-website' <- this url is your bucket url, it is the right one. Just open it in the browser and you will see that you get the expected xml response.

qoomon commented 3 years ago

I get a 404 when I open https://env.dataplatform.tech.ec.europa.eu/index.html. May you can give me the right address to you bucket browser html

qoomon commented 3 years ago

do you need any further support?