apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.37k stars 364 forks source link

Images loaded by ajax not beeing rewritten correctly #900

Open Gonzo2028 opened 9 years ago

Gonzo2028 commented 9 years ago

As you can see here: https://mysexyescort.de the images are "bad quality" on initial load, cause of heavily optimization. if you click the logo at the top, the site is beeing loaded by pushState(); and the images will be loaded by their original quality. IPRO is enabled.

With this highly optimizes site for speed i am getting very bad results in insights. Thats strange.

Edit: I think i got all to work: using the latest software here: https://mysexydate.de/, but Ajax-Loading still seems to differ from normal fullRequests. I 'll do some testing soon. Next week i am going to recompile nginx with the latest pagespeed sources and then i ll do some additional testing. Thanks for helping again

I ll report back asap.

jeffkaufman commented 9 years ago

If your images are being rewritten by IPRO and they're being more compressed than you like, try setting the quality higher:

pagespeed ImageRecompressionQuality 90;
Gonzo2028 commented 9 years ago

No, that is not the issue ;). I just removed the quality settings for now. The issue is that images are optimized on initial loading only. loading them by ajax does give me the full quality image which is somewhat stupid, because the whole page loades by ajax ;)

jeffkaufman commented 9 years ago

When they load by AJAX they should get IPRO optimization.

Can you give an example of an image URL that's loaded by AJAX and not being optimized?

Gonzo2028 commented 9 years ago

Go to https://mysexyescort.de/ . If you click any link from the navigation, or better on the logo at the center-top. By clicking the logo, the site (the content, all, except of the topNav and the footer) is beeing loaded by ajax. Click the logo, you ll get normal images, load the site by pressing F5 or on initial load gives you shrinked and optimized images. The difference now is minor, because i am using default quality settings now, but its there. In Chromium initial loaded images are webp (mostly inlined) and on the ajax content those are jpegs.

jeffkaufman commented 9 years ago

I clicked the logo at the center top, and all the images were listed in the html and their urls had ".pagespeed." in them, so it doesn't sound like these are being loaded over AJAX. If you can give me an example url that is (a) being loaded with AJAX and (b) not being optimized in place then I can debug this.

Gonzo2028 commented 9 years ago

The images loaded by ajax differ from those loaded initially. Clicking any link will load the side by ajax. Pressing F5 or using the browser-reload function will reload it initially. I am getting webp initially and jpeg over ajax. The ajax images seem to have way better Quality then the initial loaded images.

Having .pagespeed in the filename doesnt mean that its working correctly. I d expect same markup and images like when loading normally.

jeffkaufman commented 9 years ago

I'm really sorry, but I'm not able to get the site to load any images over ajax. One way to tell whether an image is being loaded via ajax is whether the url says ".pagespeed." in it. Any ".pagespeed." urls aren't loaded with ajax.

What I do see is that when I first load a page the images are either unoptimized or JPEGs, and when I reload it they're WebPs. This is expected behavior: WebP conversion is slow, and we don't want PageSpeed to delay the page loading, so we have the optimization continue in the background.

Gonzo2028 commented 9 years ago

Well, in between i changed a lot of the servers configuration. I am replacing images with dara-src-mobile, data-src-highres and data-src-normal after onload depending on viewport, loading mobile as default.

Even with a warmed up cache the Ajax is responsing with jpegs, while initial load is showing webp images.

Watch the xhr response in your dev console (watch for ajaxNew.php):