aws / aws/aws-cdk

(@aws-cdk/aws-s3-deployment): guess mime type - webp support

Open
#11,890 11 comments 1 reaction 1 assignee Claimed by @iliapolo View on GitHub
@aws-cdk/aws-s3-deployment closed-for-staleness feature-request
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

It would be very useful if using the `BucketDeployment` construct from `@aws-cdk/aws-s3-deployment` would correctly guess the mime type of **webp** images deployed. Currently, instead of setting the expected `Content-type: image/webp` on the S3 objects, I'm getting `Content-type: binary/octet-stream` on all webp images deployed.

### Use Case

[webp](https://developers.google.com/speed/webp) is a modern format that allows to dramatically reduce amount of bytes transferred over the wire. Setting the right `Content-type` is essential in helping browsers / cdn / proxies correctly understand the file being transferred.

### Proposed Solution

If I understand correctly, the underlying aws sdk used to deploy files already attempts to guess the mime type. It does so already for images like png or jpeg. The problem may come from configuration of the SDK or the underlying runtime environment who does not have webp (and probably many other types) configured.

### Other

Potentially linked to https://github.com/aws/aws-cli/issues/1249

* [x] :wave: I may be able to implement this feature request **with guidance**
* [ ] :warning: This feature might incur a breaking change

---

This is a :rocket: Feature Request

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.