0

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?

0

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .