Reputation: 926
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:
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
yields binary dataaccept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
yields base64 data (and the image is broken in the webpage)accept: image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
yields binary dataFrom 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
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