Suboptimal response for /ngx_pagespeed_static/js_defer.hash.js #212

Closed
oschaaf opened this Issue Apr 3, 2013 · 6 comments

Projects

None yet

3 participants

@oschaaf
Member
oschaaf commented Apr 3, 2013
curl -I -X GET -H "Accept-Encoding: gzip"  http://127.0.0.1/ngx_pagespeed_static/js_defer.4Wv5zwfokU.js

Outputs these response headers:

HTTP/1.1 200 OK
Server: nginx/1.3.7
Date: Wed, 03 Apr 2013 11:31:23 GMT
Content-Type: application/javascript
Content-Length: 11422
Connection: keep-alive
Cache-Control: max-age=31536000

Note that there is no compression, and no E-Tag: W/0.
The compression can be fixed by adding a line like this to nginx.conf:

gzip_types application/javascript; 

The E-Tag is something that we may want to look in to, as currently enabling defer_javscript will deduct points from pagespeed scores because of this.

@jeffkaufman
Member

gzip_types application/javascript;

This doesn't fix the compression issue in my testing. pagespeed_test.conf.template has it already and I'm seeing this test I added for it fail: https://github.com/pagespeed/ngx_pagespeed/compare/jefftk-gzip-static-js

It also fails in manual testing.

@oschaaf
Member
oschaaf commented Apr 15, 2013

I have to sort out what it is then, it seems configuration specific. I can confirm that testing it on our test configuration doesn't give a compressed response. On my own configuration however, I still do get a compressed response.

@oschaaf
Member
oschaaf commented Apr 19, 2013

@jeffkaufman "This doesn't fix the compression issue in my testing. pagespeed_test.conf.template has it already and I'm seeing this test I added for it fail: https://github.com/pagespeed/ngx_pagespeed/compare/jefftk-gzip-static-js"

This seems a bit weird, some seemingly unrelated gzip_type lines in pagespeed_test.conf.template seem to break the test.
When I comment a few lines, the test passes:

...
  # Turn on gzip for all content types that should benefit from it.                                   
  gzip_types application/javascript;
  #gzip_types application/ecmascript;                                                                      
  gzip_types application/json;
  #gzip_types application/pdf;                                                                             
  #gzip_types application/postscript;                                                                      
  #gzip_types application/x-javascript;                                                                    
  #gzip_types image/svg+xml;                                                                               
  gzip_types text/css;
  gzip_types text/csv;
  # "gzip_types text/html" is assumed.                                                                     
  #gzip_types text/javascript;                                                                             
  #gzip_types text/plain;                                                                                  
  #gzip_types text/xml; 
...
@jeffkaufman
Member

That is completely bizarre.

@oschaaf oschaaf was assigned May 8, 2013
@jeffkaufman
Member

Both the javascript and etag parts of this are now fixed:

Server: nginx/1.4.1
Date: Thu, 16 May 2013 00:14:20 GMT
Content-Type: application/javascript
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Cache-Control: max-age=31536000
X-Extra-Header: 1
Content-Encoding: gzip
@benoit934
Contributor

Fine, i'll update
Edit : Fixed for me too, thanks

@dinic dinic pushed a commit to dinic/ngx_pagespeed that referenced this issue Dec 19, 2013
@oschaaf oschaaf static-handler-etag: emit an etag in responses from our static handler
Fixes the etag part of pagespeed#212
51ca3af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment