Auto WebP is Activated but Content Type Still JPEG
tcagkansokmen opened this issue · 5 comments
Describe the bug
I've newly installed version 6.1.1.
I've enabled "AutoWebp" and you can see configuration below:
After I resize a photo, I send a "postman request" to see whats content type.
And it returns "image/jpeg" as you can see.
Please complete the following information about the solution:
- Version:6.1.1
- Region: us-east-1
- Was the solution modified from the version published on this repository? No
- If the answer to the previous question was yes, are the changes available on GitHub?
You'd have to make sure your postman request has an accepts header that contains image/webp. Could that be why it is still returning a jpg?
See here for how it decides if it should serve a webp image or not: https://github.com/aws-solutions/serverless-image-handler/blob/develop/source/image-handler/image-request.ts#L431
Thanks for your report. We added it to our backlog and will get back to you with more information.
@tetz2442 the event.headers
object looks like this in my case:
{
headers: {
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8'
}
}
So in this line:
We should use
.accept
, or check both accept and Accept.+1 Confirming this issue on 6.1.2 when accept: image/webp
is present in request, content-type: image/jpeg
is in response.
resolved in v6.2.4