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 ofimages
,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?