Configure subdomain for static assets

131 views
Skip to first unread message

Ivan

unread,
Dec 26, 2015, 12:40:14 PM12/26/15
to ngx-pagespeed-discuss

Hi,
I have two domains: https://www.website.it and https://assets.website.it configured nginx 1.9.9 (ssl and HTTP2) and ngx_pagespeed 1.10.33.2

On https://assets.website.it it configured the rule:

  pagespeed EnableFilters convert_jpeg_to_webp;


  pagespeed
Domain https://assets.website.it;
  pagespeed
LoadFromFile "https://assets.website.it" "/var/www/assets.website.it/";


but if I call an image from https://www.website.it not turns into webp. What am I doing wrong?

Otto van der Schaaf

unread,
Dec 27, 2015, 2:37:37 PM12/27/15
to ngx-pagespeed-discuss
If you look at the html source of your page with ?PageSpeedFilters=+debug appended to the querystring, ngx_pagespeed may output helpful debug comments after the image tags. Could you have a look at those comments to see if they provide any helpful hints?

Otto

Ivan

unread,
Dec 27, 2015, 2:49:31 PM12/27/15
to ngx-pagespeed-discuss
Hi Otto,
look:

<img src="https://assets.website.it/250_92568.jpg" height="150" width="150" alt="xxx" data-pagespeed-url-hash="759252417" data-pagespeed-onload="pagespeed.CriticalImages.checkImageForCriticality(this);" onload="var elem=this;if (this==window) elem=document.body;elem.setAttribute('data-pagespeed-loaded', 1)"><!--The preceding resource was not rewritten because its domain (assets.website.it) is not authorized-->


Otto van der Schaaf

unread,
Dec 28, 2015, 7:12:35 AM12/28/15
to ngx-pagespeed-discuss
I tried to also get the "not authorized" debug comment with the configuration you gave above (though with different hostnames), but for me it works fine.

A few things to check:
- Are there any warnings/errors in nginx's error.log mentioning "250_92568.jpg"?
- A typo could also cause this, so maybe double check for spelling errors in domain names.

If that didn't help, could you post all your pagespeed-related configuration?

Otto

Ivan

unread,
Dec 28, 2015, 7:40:40 AM12/28/15
to ngx-pagespeed-discuss
Hi,
these are the configuration files of nginx & pagespeed:

Otto van der Schaaf

unread,
Dec 28, 2015, 10:41:18 AM12/28/15
to ngx-pagespeed-discuss
- Could you move the line "pagespeed Domain https://assets.website.it" to the server{} block that hosts https://www.website.it/ ?
- This doesn't really hurt, but the line "pagespeed Domain https://www.website.it" looks oddly placed, is there any specific reason that you want to have that in the server{} block for www.website.it ?

Also, I noticed you are applying 'pagespeed RespectXForwardedProto on;', which looks a bit out of place as both sites seem to be running on https.
Is there any specific reason you need RespectXForwardedProto to be turned on?

Otto

Ivan

unread,
Dec 28, 2015, 11:12:23 AM12/28/15
to ngx-pagespeed-discuss
Oh, very well!

Now the server {} www.website.it is so:

server {
[...]
pagespeed Domain https://www.website.it;
pagespeed LoadFromFile "https://www.website.it" "/var/www/www.website.it/";

pagespeed Domain https://assets.website.it;
pagespeed LoadFromFile "https://assets.website.it" "/var/www/assets.website.it/";
[...]
}


It works well.

Thanks Otto!

Ivan

unread,
Feb 19, 2016, 9:56:46 AM2/19/16
to ngx-pagespeed-discuss
Hello,
today is something strange happened ... After the upgrade nginx 1.9.11 and ngx_pagespeed 1.10.33.5 has come back this problem!

What can I try?

Ivan

unread,
Feb 19, 2016, 10:05:22 AM2/19/16
to ngx-pagespeed-discuss
No, wait!

With http2 & ngx_brotli on chrome jpeg they are transformed into webp! (I think because it does chrome 48 not yet support Brotli, in fact, the content-Enconding is gzip).

With 44 firefox images remain jpeg (but the content-Enconding is "br").

I do not know…

Jeffrey Crowell

unread,
Feb 19, 2016, 10:27:04 AM2/19/16
to ngx-pagespeed-discuss
Firefox 44 doesn't support WebP, but does support brotli

Chrome 48 does support WebP, but doesn't support brotli


So those content encodings/image formats do make sense.

--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.
Visit this group at https://groups.google.com/group/ngx-pagespeed-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages