Issues hosting Hugo on AWS S3

Hello,

I followed all the steps to setup a simple Hugo blog on AWS S3 in us-east-1, but S3 will not serve the css/style.css file.

While inspecting Chrome, the network times out after about 60-90 seconds while trying to request the file. After the browser stalls for this length of time, the content is displayed with no formatting.

I’ve tried this with 2-3 themes and I see the same problem. The current theme I’m using is hucore.

I checked the css/style.css Metadata in my S3 bucket and it is correctly set to Content-Type: text/css.

What the steps needed to get CSS working correctly for Hugo in S3?

Figured it out. I was using the https://bucket.s3-website-us-east-1.amazonaws.com/ URL instead of https://s3.amazonaws.com/bucket for the baseurl in config.toml. I have no idea why the latter URL works and the other doesn’t, considering the latter is what’s displayed in the AWS S3 console when browsing your bucket files.

Probably because you haven’t configured your bucket as a static website? If you do, it should become accessible through bucket-name.s3-website-region.amazonaws.com.

1 Like

Thanks @Jura this fixed it for me!