ngx_page_speed just works with html

23 views
Skip to first unread message

Pablo nm

unread,
Jun 11, 2017, 4:21:15 AM6/11/17
to mod-pagespeed-discuss
I have nginx with pagespeed module all set up, when i visit my webpage and check all the requests the browser makes to loading the site i realize that the x-page-speed is just set for the html file, all other files(.js, .css,etc) lack it,  therebefore any optimization is missing for this files(the optimization in the html works great). You can check this behavior if you go to flashcard-x.com.
here is my nginx.conf:

user www-data;
worker_processes 1;

#error_log logs/error.log; error_log logs/error.log notice; error_log
#logs/error.log info;

#pid logs/nginx.pid;


events {
    worker_connections 1024;
}


http {
       pagespeed on;

     # Needs to exist and be writable by nginx.
        pagespeed FileCachePath /var/ngx_pagespeed_cache;
        pagespeed EnableFilters combine_css,rewrite_css,combine_javascript;
        include mime.types;
       default_type application/octet-stream;
    
       sendfile on;
        keepalive_timeout  65;
        
  server{
   location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" "";$

   
        location /ngx_pagespeed_statistics { allow all; }
location /ngx_pagespeed_global_statistics { allow all; }
location /ngx_pagespeed_message { allow all; }


        listen       80;
        server_name  flashcard-x.com;
 location / {
                proxy_pass http://localhost:8081;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }

      }
}

Otto van der Schaaf

unread,
Jun 11, 2017, 4:43:33 AM6/11/17
to mod-pagespeed-discuss
Hi,

If you check out view-source:http://flashcard-x.com/home?PageSpeedFilters=+debug you'll see lots of debug comments from the module like:
<!--Uncacheable content, preventing rewriting of http://flashcard-x.com/assets/css/component/general.css--> 

Querying http://flashcard-x.com/assets/css/component/general.css shows these response headers:
HTTP/1.1 200 OK Server: nginx/1.13.1 Date: Sun, 11 Jun 2017 08:40:51 GMT Content-Type: text/css; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Vary: Accept-Encoding X-Powered-By: Express Cache-Control: public, max-age=0 Last-Modified: Mon, 05 Jun 2017 05:00:35 GMT ETag: W/"44f-15c76a04a16" Content-Encoding: gzip 

Pagespeed will not optimize this, because of the restrictive cache control header.
You can either set up LoadFromFile (recommended if possible in your setup) (https://modpagespeed.com/doc/domains#ModPagespeedLoadFromFile) or make the response for static assets cacheable to get ngx_pagespeed to optimize these assets.

Otto
 

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/a2d1185a-c039-4e8b-a44c-61e01d65675e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages