Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Images don't get converted to webp in ajax requests #2085

Open
datamints-off opened this issue Oct 29, 2021 · 8 comments
Open

Images don't get converted to webp in ajax requests #2085

datamints-off opened this issue Oct 29, 2021 · 8 comments

Comments

@datamints-off
Copy link

We're using a banner system to load ads via ajax. The images in the ajax responses are handled by mod_pagespeed, but they're not converted to webp. If I call the ajax url directly in the browser, the image is delivered as webp. Is this some kind of bug or do we have to adjust our configuration?

Example: Visit https://www.whisky.de/forum/ and check the banner on top, then call https://www.whisky.de/?type=9001&tx_sfbanners_pi1%5Baction%5D=getBanners&tx_sfbanners_pi1%5Bcontroller%5D=Banner&tx_sfbanners_pi1%5BcurrentPageUid%5D=1&tx_sfbanners_pi1%5Bhmac%5D=5c7c784ee0e0f4c801dfbb52b15426ceed38550f&tx_sfbanners_pi1%5BstartingPoint%5D=&tx_sfbanners_pi1%5Bcategories%5D=579&tx_sfbanners_pi1%5BdisplayMode%5D=random&cHash=012f2fb0e52bdaaee69016443b9e3f21

@Lofesa
Copy link
Contributor

Lofesa commented Oct 29, 2021

Hi
Not only the banner, seems is in all images that are precessed by pagespeed, like:

https://www.whisky.de/shop/out/pictures/generated/product1/380_280_75ximage_AUCHE0SA0_1.jpg.pagespeed.ic.IGu2yp7Fut.jpg

All these images get processed by pagespeed but not converted to web.
And seems all are downloaded by javascript so at a start they don´t are pagespeed processed unless by IPRO, but IPRO don´t chage the url.
Also seems that https://www.whisky.de/ is running pagespeed but https://www.whisky.de/forum/ not.

What´s the config for this site?

@jmarantz
Copy link
Contributor

jmarantz commented Oct 29, 2021 via email

@datamints-off
Copy link
Author

@jmarantz Yes, I checked the content type: the browser accepts image/webp,image/apng,image/svg+xml,image/*, the server returns image/jpeg.

@datamints-off
Copy link
Author

@Lofesa The site consists of three systems behind a Nginx reverse proxy. mod_pagespeed is not enabled for the one at /forum, but for the one at / (you can see this when checking the images at https://www.whisky.de).

@datamints-off
Copy link
Author

datamints-off commented Oct 29, 2021

This is the configuration for mod_pagespeed:

<IfModule pagespeed_module>
	ModPagespeed on
	AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
	ModPagespeedDomain *.whisky.de
	ModPagespeedDomain https://*.whisky.de
	ModPagespeedDisallow */typo3/*
	ModPagespeedDisallow */tiny_fck/*
	ModPagespeedDisallow */modules/wysiwyg/*
	ModPagespeedDisallow */ckeditor/*
	ModPagespeedRespectXForwardedProto on
	ModPagespeedUrlValuedAttribute a data-zoom-image image
	ModPagespeedUrlValuedAttribute a data-image image
	ModPagespeedRewriteLevel PassThrough
	ModPagespeedEnableFilters rewrite_images
	ModPagespeedLazyloadImagesAfterOnload off
</IfModule>

@jmarantz
Copy link
Contributor

One other subtlety around this: there are few caches in the path, potentially that may need to be warmed by retrying a few times.

  • mod_pagespeed's server-side cache: the first time an image is requested, it will likely be returned unoptimized while it optimizes in the background
  • browser-cache
  • any caches in the serving path (e.g. varnish)
  • ISP caches

usually shift-refresh in the browser a few times gets you the fully optimized versions.

@Lofesa
Copy link
Contributor

Lofesa commented Oct 29, 2021

Hi
Even in https://www.whisky.de/ banner images are not webp converted but images in the html code get it.
Son I´m still thinking is how javascript request the image or how it creates the dom node

@datamints-off
Copy link
Author

Thanks for all your input: I found that the accept header of the request fetching the banner is not stating that webp images are accepted. I will change that on the client and the problem should be solved.

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

No branches or pull requests

3 participants