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

LoadFromFile logs errors on 404s #972

Closed
jeffkaufman opened this issue May 27, 2015 · 4 comments
Closed

LoadFromFile logs errors on 404s #972

jeffkaufman opened this issue May 27, 2015 · 4 comments

Comments

@jeffkaufman
Copy link
Contributor

@jeffkaufman jeffkaufman commented May 27, 2015

If you turn on LoadFromFile then 404s turn into errors in the log.

To reproduce:

$ fname=${RANDOM}.nonexistent.png
$ curl www.jefftk.com/$fname -o /dev/null
$ curl -sS http://www.jefftk.com/pagespeed_admin/message_history | grep -o "Failed to stat /var/www/$fname"
@crowell
Copy link
Contributor

@crowell crowell commented May 28, 2015

fix is ready for review, going into mod_pagespeed code.

@crowell
Copy link
Contributor

@crowell crowell commented May 29, 2015

@crowell crowell closed this May 29, 2015
@jeffkaufman jeffkaufman changed the title Failed to stat error with LoadFromFile LoadFromFile logs errors on 404s Jul 27, 2015
@Mr-Anonymous
Copy link

@Mr-Anonymous Mr-Anonymous commented Aug 16, 2015

Hi @jeffkaufman and @crowell, I am pulling my hair over an issue I am facing and I wonder if its related to this issue reported here. My joomla site on nginx occasionally throws a 404 error when page exists and the user sees a 404 page. But when they refresh that page, the page loads fine. By checking all settings from both server end and joomla end, I couldnt find anything wrong with it. I was then suspecting if pagespeed was causing the 404 error due to perhaps cache unavailable which shouldnt really happen. This is when I came across this ticket. Could this issue posted here by @jeffkaufman be the reason for my 404 error on page? My error log looks like this when I got a 404 error when page exists:

49.xxx.xxx.xx - - [16/Aug/2015:21:43:42 +1000] "GET /category/articles/example-article-name HTTP/1.1" 404 9729 "-" "Mozilla/5.0 (iPad; CPU OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4"
49.xxx.xxx.xx - - [16/Aug/2015:21:43:46 +1000] "GET /templates/portfolio/fonts/fontawesome-webfont.woff?v=4.2.0 HTTP/1.1" 200 65452 "http://example.com.au/category/articles/example-article-name" "Mozilla/5.0 (iPad; CPU OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4"
49.xxx.xxx.xx - - [16/Aug/2015:21:43:46 +1000] "GET /media/com_easysocial/fonts/easysocial.woff HTTP/1.1" 200 42800 "http://example.com.au/category/articles/example-article-name" "Mozilla/5.0 (iPad; CPU OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4"

Same link when it was clicked again, opened fine with 200 status:

49.xxx.xxx.xx - - [16/Aug/2015:22:02:47 +1000] "GET /category/articles/example-article-name HTTP/1.1" 200 17683 "-" "Mozilla/5.0 (iPad; CPU OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4"

However, the second time when the error did not happen, no .woff file was requested. Not sure if they are related, or if my problem is related to the pagespeed cache not found causing a 404 in Joomla like the issue reported above.

I have nginx + pagespeed on debian 7 which was installed using Dotdeb Extras package.

Lastly, if I do apt-get update, would the ngx_pagespeed in dotdeb be updated too?

Can you share your thoughts please? I have been investigating this unknown issue for weeks now. :(

@Mr-Anonymous
Copy link

@Mr-Anonymous Mr-Anonymous commented Aug 16, 2015

This is my ngx_pagespeed config file:

# PageSpeed
# Enable ngx_pagespeed
pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
pagespeed MemcachedServers "localhost:11211";

# Mapping Static Files to Disk
pagespeed LoadFromFile "http://example.com.au"
                       "/var/www/example/public_html/";

location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
  add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
location /ngx_pagespeed_global_statistics { allow 127.0.0.1; deny all; }
location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }

# HTML Related - Collapse Whitespaces, Remove comments
pagespeed EnableFilters collapse_whitespace;
pagespeed EnableFilters remove_comments;

# Minify Javascript
pagespeed EnableFilters rewrite_javascript;
pagespeed EnableFilters combine_javascript;
pagespeed EnableFilters canonicalize_javascript_libraries;
# Inline small javascript files
pagespeed EnableFilters inline_javascript;
pagespeed JsInlineMaxBytes 6144;

# Inline and minimize css
pagespeed EnableFilters rewrite_css;
pagespeed EnableFilters fallback_rewrite_css_urls;
pagespeed EnableFilters combine_css;
# Loads CSS faster
pagespeed EnableFilters move_css_above_scripts;
pagespeed EnableFilters move_css_to_head;
# Inline small css files
pagespeed EnableFilters inline_css;
pagespeed CssInlineMaxBytes 5120;

# Rewrite, resize and recompress images
pagespeed EnableFilters rewrite_images;

# Extend Cache
pagespeed EnableFilters extend_cache;
pagespeed EnableFilters extend_cache_pdfs;

# Google Analytics
pagespeed EnableFilters insert_ga;
pagespeed AnalyticsID UA-xxxxxxxx-x;
@pono pono unassigned crowell Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants