Uche Ozoemena
Uche Ozoemena

Reputation: 926

configure aws lambda and api gateway to return binary data for image/avif content-type

There's no shortage of questions and blog posts about binary data using aws lambda and api gateway, but surprisingly I haven't been able to find anything related to AVIF images. This is important because of this issue in chromium. Essentially the chrome team recently added "image/avif" to the beginning of its Accept header for images, and that's causing my endpoint to return the base64 string of an image rather than the binary data. If I repeat the same request using curl and remove the "image/avif" from the Accept header, I get the binary data. Concretely:

From the discussion in the chromium thread, it seems that the solution is to update my endpoint to respond with the appropriate binary data when the Accept header begins with "image/avif". However, this is proving difficult for me. The closest I've come is this answer. I've followed those steps to update my API gateway config but I'm still getting base64 data when the Accept header begins with "image/avif". And I haven't found any posts specifically referring to this issue.

Upvotes: 1

Views: 768

Answers (1)

Uche Ozoemena
Uche Ozoemena

Reputation: 926

As it turns out that guide I linked to in the post had all the necessary steps, but the "save changes" button in the API Gateway dashboard doesn't actually deploy your changes. You have to go to Resources > Actions > Deploy API to make the changes live.

Upvotes: 0

Related Questions