"<!--4xx status code, preventing rewriting of..."

1,045 views
Skip to first unread message

Amin Sabet

unread,
Aug 22, 2016, 2:10:34 PM8/22/16
to ngx-pagespeed-discuss
Hi,



I see:

<img src="attachments/cousins-jpg.132767/" alt="cousins.jpg" class="bbCodeImage LbImage" data-pagespeed-url-hash="1372094820" onload="pagespeed.CriticalImages.checkImageForCriticality(this);"/><!--4xx status code, preventing rewriting of https://www.mu-43.com/attachments/cousins-jpg.132767/--><!--4xx status code, preventing rewriting of https://www.mu-43.com/attachments/cousins-jpg.132767/-->


Why is that?

My pagespeed.conf:

pagespeed on;
pagespeed FileCacheSizeKb 1638400;
pagespeed LRUCacheKbPerProcess 8192;

pagespeed Domain "https://www.mu-43.com";
pagespeed Domain "https://www.talkemount.com";
pagespeed Domain "https://www.fujixspot.com";
pagespeed Domain "https://www.leicaplace.com";
pagespeed Domain "https://www.foreverfilm.org";
pagespeed Domain "https://www.vrfora.com";

pagespeed LoadFromFile "https://www.mu-43.com" "/home/nginx/domains/mu-43.com/public";
pagespeed LoadFromFile "https://www.talkemount.com" "/home/nginx/domains/talkemount.com/public";
pagespeed LoadFromFile "https://www.fujixspot.com" "/home/nginx/domains/fujixspot.com/public";
pagespeed LoadFromFile "https://www.leicaplace.com" "/home/nginx/domains/leicaplace.com/public";
pagespeed LoadFromFile "https://www.photographerslounge.org" "/home/nginx/domains/photographerslounge.org/public";
pagespeed LoadFromFile "https://www.foreverfilm.org" "/home/nginx/domains/foreverfilm.org/public";
pagespeed LoadFromFile "https://www.vrfora.com" "/home/nginx/domains/vrfora.com/public";

pagespeed LoadFromFileRuleMatch disallow .*;
pagespeed LoadFromFileRuleMatch allow \.css$;
pagespeed LoadFromFileRuleMatch allow \.jpe?g$;
pagespeed LoadFromFileRuleMatch allow \.png$;
pagespeed LoadFromFileRuleMatch allow \.gif$;
pagespeed LoadFromFileRuleMatch allow \.js$;



Thanks for any help!

-Amin

Amin Sabet

unread,
Aug 22, 2016, 2:14:44 PM8/22/16
to ngx-pagespeed-discuss

Otto van der Schaaf

unread,
Aug 22, 2016, 3:34:55 PM8/22/16
to ngx-pagespeed-discuss
- You may be getting the "4xx status code" debug messages for the images in /attachments/ because that path is not covered by the LoadFromFile configuration you have, and ngx_pagespeed does not know how to load these.
- Your second question about resources not being authorized remind me of your earlier post in mod-pagespeed-discuss [1]. I'm still curious about the same question I asked over there:
Are you terminating https in front of where ngx_pagespeed is running? 

Amin Sabet

unread,
Aug 22, 2016, 3:41:32 PM8/22/16
to ngx-pagespeed-discuss
On Monday, August 22, 2016 at 3:34:55 PM UTC-4, Otto van der Schaaf wrote:
- You may be getting the "4xx status code" debug messages for the images in /attachments/ because that path is not covered by the LoadFromFile configuration you have, and ngx_pagespeed does not know how to load these.

How can I change my LoadFromFile configuration to cover /attachments/ ?  Any suggestion?
 
- Your second question about resources not being authorized remind me of your earlier post in mod-pagespeed-discuss [1]. I'm still curious about the same question I asked over there:
Are you terminating https in front of where ngx_pagespeed is running? 


Sorry, I don't know what that means (terminating https in front of where ngx_pagespeed is running?).  Will ask my server admin to have a look at this.

Otto van der Schaaf

unread,
Aug 22, 2016, 4:05:23 PM8/22/16
to ngx-pagespeed-discuss
- You may be getting the "4xx status code" debug messages for the images in /attachments/ because that path is not covered by the LoadFromFile configuration you have, and ngx_pagespeed does not know how to load these.

How can I change my LoadFromFile configuration to cover /attachments/ ?  Any suggestion?

As an example, take the image at /attachments/cousins-jpg.132767/ : I suspect some form of url rewriting is performed here. 
LoadFromFile will attempt to map the url to a file on disk and look for /home/nginx/domains/mu-43.com/public/attachments/cousins-jpg.132767/ . I suspect that file will not exist.

You could exclude /attachments/ from being mapped by LoadFromFile, for example:
pagespeed LoadFromFileRuleMatch Disallow .*/attachments/.*;


 
- Your second question about resources not being authorized remind me of your earlier post in mod-pagespeed-discuss [1]. I'm still curious about the same question I asked over there:
Are you terminating https in front of where ngx_pagespeed is running? 


Sorry, I don't know what that means (terminating https in front of where ngx_pagespeed is running?).  Will ask my server admin to have a look at this.

Last time it looked like you had at least a reverse proxy (nginx) and a webserver running (Apache). I suspect that nginx was handling https requests, and forwarding these requests on plain http to Apache.
When you do that, the reverse proxy should forward the original incoming protocol to the webserver so mod_pagespeed can determine the original protocol that was used to serve the html to the browser. 

I'm not sure about what your setup looks like now either, but it seems things have recently changed because now you are running ngx_pagespeed instead of mod_pagespeed. 
See https://developers.google.com/speed/pagespeed/module/https_support#RespectXForwardedProto - perhaps your server admin can help you with forwarding the X-Forwarded-Proto header.

Otto


Amin Sabet

unread,
Aug 22, 2016, 4:19:42 PM8/22/16
to ngx-pagespeed-discuss
Thank you, Otto!  -Amin
Reply all
Reply to author
Forward
0 new messages