0

I have hosted a static website in the s3 bucket successfully, but CSS, JS files, and images paths are getting an error as below. Due to that UI not displayed proper.

enter image description here

All JS, CSS, and images are in the assets folder.

Thanks in advance.

rvchauhan
  • 89
  • 8
  • What are the exact settings of the bucket you used? – Marcin Mar 17 '21 at 05:36
  • Static Web Hosting => Enabled, Permission access is => Public, and bucket policy is as below { "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::frontend/*" } ] } – rvchauhan Mar 17 '21 at 05:40
  • Need to enabled or disabled any settings, then let me know. = @Marcin – rvchauhan Mar 17 '21 at 05:43
  • also, make sure the upper/lowercasing is correct - not all web hosts are case-sensitive, but s3 websites are. – E.J. Brennan Mar 17 '21 at 08:21
  • case-sensitive is proper, I have checked. – rvchauhan Mar 17 '21 at 09:45

1 Answers1

0

Solution 1 => I found the solution, the issue was the folder structure that I have not created on the S3 bucket.

assets/css/filename.css
assets/js/filename.js

create the same folder structure that has in your project and uploaded files on the respective folder.

Solution 2 => you can remove the path, instead, just put the filename in index.html like this.

  <link rel="stylesheet" href="bootstrap.min.css" lazyload="1">

It was working for me, both the solution.

rvchauhan
  • 89
  • 8