Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto WebP is Activated but Content Type Still JPEG #467

Closed
4 tasks done
tcagkansokmen opened this issue Apr 17, 2023 · 5 comments
Closed
4 tasks done

Auto WebP is Activated but Content Type Still JPEG #467

tcagkansokmen opened this issue Apr 17, 2023 · 5 comments
Assignees
Labels

Comments

@tcagkansokmen
Copy link

tcagkansokmen commented Apr 17, 2023

Describe the bug
I've newly installed version 6.1.1.
I've enabled "AutoWebp" and you can see configuration below:

image

After I resize a photo, I send a "postman request" to see whats content type.
image

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?
@tetz2442
Copy link

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

@dougtoppin
Copy link
Contributor

Thanks for your report. We added it to our backlog and will get back to you with more information.

@kevinzg
Copy link

kevinzg commented Apr 24, 2023

@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:

if (AUTO_WEBP === "Yes" && event.headers.Accept && event.headers.Accept.includes(ContentTypes.WEBP)) {

We should use .accept, or check both accept and Accept.

@ccchapman
Copy link

+1 Confirming this issue on 6.1.2 when accept: image/webp is present in request, content-type: image/jpeg is in response.

@dougtoppin
Copy link
Contributor

resolved in v6.2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants