'Add content type for each file type on S3 bucket which uses cloudfront

I am facing issue while rending the files from S3 bucket. We are using cloudfront distribution for S3 bucket.

We have SCORM package which we upload on S3 and when we access, it render with cloudfront url e.g. https://xxxxx.cloudfronturl.com/scorm_package/index.html file also this SCORM package contains the CSS and JS files which is required for rendering SCORM package content. But I have observed CSS and JS file which is present inside SCORM folder it also render with content-type: text/html instead of text/css for CSS and application/javascript for JS files.

How can I set the content type for CSS files as content-type: text/css and JS files as contet-type: application/javascript on S3 with cloudfront?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source