How to set correct Content-Type HTTP header for all files uploaded on S3 bucket?

wf flag

What is please the correct way to set Content-Type HTTP header for files uploaded on S3 bucket? We use S3 bucket as an origin server for hosting static websites. Bucket is accessed through the Cloudflare CDN.

After copying the files, the Content-Type by default is set to binary/octet-stream.

  • Of course, I can set it up when copying via the AWS CLI for individual files, but even with reasonable automation, it's extra work, and then, in addition to .js, .html, .css, there are also a number of images, fonts, videos, json files, etc. It seems pointless to me to set the correct content type for each file type.

  • I can also set it up with rules on the CDN, but again that's per file type.

Is it not possible to instruct the S3 bucket so that it automatically sets the Content-Type in a similar way as web servers like nginx or Apache do?

wf flag

I figured out that there is no problem and it was all caused by the way the MAC OS version of the CloudBerry - GUI software we have used to copy files to S3 bucket.

CloudBerry enforced the binary/octet-stream content type when files were copied to S3 (I am not sure why, it might be some setting/option - I have not explored that further). Switching to AWS CLI and overwriting all files fixed the problem.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.