nginx 1.4.3 + ngx_pagespeed -1.6.29.7 problem

79 views
Skip to first unread message

Peter Smith

unread,
Jan 15, 2015, 3:22:09 PM1/15/15
to ngx-pagesp...@googlegroups.com
Hello,

I have a live web server running the following: RHEL 6.6, Nginx 1.4.3, ngx_pagespeed 1.6.29.7. I needed a dev environment, so set about building an identical (or as close to identical as I could) machine.

Here's a snip of my HTML before pagespeed gets its hands on it:

<link rel="stylesheet" type="text/css" href="https://5.44.17.43/skin/frontend/enterprise/mdtheme/css/styles.css" media="all"/>
<link rel="stylesheet" type="text/css" href="https://5.44.17.43/skin/frontend/enterprise/default/css/widgets.css" media="all"/>
<link rel="stylesheet" type="text/css" href="https://5.44.17.43/skin/frontend/enterprise/default/pronav/css/pronav.default.css" media="all"/>
<link rel="stylesheet" type="text/css" href="https://5.44.17.43/skin/frontend/base/default/magmodules/snippets.css" media="all"/>
<link rel="stylesheet" type="text/css" href="https://5.44.17.43/skin/frontend/base/default/magmodules/breadcrumbs.css" media="all"/>

But with pagespeed enabled:

<link rel="stylesheet" type="text/css" href="http://5.44.17.43/skin/frontend/enterprise/mdtheme/css/A.styles.css.pagespeed.cf.a5tJl_nEYZ.css" media="all"/>
<link rel="stylesheet" type="text/css" href="http://5.44.17.43/skin/frontend/enterprise/default/css/A.widgets.css.pagespeed.cf.F1RDUrCZOM.css" media="all"/>
<style media="all"> �  �WQo�6~N~��`�]Q�I�i����� 7`�^� ȱ��X�,'i���#%ٖ 7-�0 A Y )��G2�p ��J� �sI�į��Z�J�
�'/�Ɏ�(�O呰ڨ/�IɲL �d � Df����Ey�_RT�V�I�P ��\ �"�y�� |�Ҫ F�"�\2#��뙊"��d	G�� ���K	K�j�5�c��Ќ�� Y8ĩ ȠٹT�$�� ��w@�C�OM�/(�sW*m �M/b0���eJ�#E�開��$d }� 6�2Q��=%�T��n9U:㚢a� |Z))22{xx8٣����f�| 7h��  U��%Uƨ����q�U]dT�؆'���C ��W �( 4�D?�����NP󒃻������̵�J'dvm�n��
5O%(u�l�l�� �"!k^ �;� Sdaq� y0��5 �+�5bk � X�[��
���� �����8`�gy�������� 302GC�� �d�� �> Ys]�w Ŭ � L׃ �
�m2�8 �&� �  ��2��4��J  �j�k Y�� ��

etc etc.

Also notice that links such as http://5.44.17.43/skin/frontend/enterprise/mdtheme/css/A.styles.css.pagespeed.cf.a5tJl_nEYZ.css output binary.

My first thought was that perhaps the CSS was being double gzipped, but that doesn't seem to be the case, and doesn't explain the binary output in the middle of my HTML doc.

I've turned the error log on in Nginx, but don't see any errors at debug level.

What makes it even stranger is that it's working fine on my live web server. There must be a subtle difference between the two somewhere, but I can't figure out what it is.

Any idea why nginx is doing this, or how I can debug it further please?



Jeff Kaufman

unread,
Jan 15, 2015, 3:29:11 PM1/15/15
to ngx-pagesp...@googlegroups.com

--
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 http://groups.google.com/group/ngx-pagespeed-discuss.
For more options, visit https://groups.google.com/d/optout.

Jeffrey Crowell

unread,
Jan 15, 2015, 3:29:25 PM1/15/15
to ngx-pagesp...@googlegroups.com
Can you provide an example of one of the css files before it gets mangled?

If you check the file type of one the example css link you gave, it is gzipped.

see:

jcrowell0 test/test2 » file A.styles.css.pagespeed.cf.a5tJl_nEYZ.css
A.styles.css.pagespeed.cf.a5tJl_nEYZ.css: gzip compressed data, from Unix
jcrowell0 test/test2 » zcat A.styles.css.pagespeed.cf.a5tJl_nEYZ.css | head -n 5 
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *

Peter Smith

unread,
Jan 15, 2015, 3:34:46 PM1/15/15
to ngx-pagesp...@googlegroups.com
I've disabled pagespeed for the https server block, so https://5.44.17.43/ vs http://5.44.17.43/

Otto van der Schaaf

unread,
Jan 15, 2015, 3:53:06 PM1/15/15
to ngx-pagesp...@googlegroups.com
It looks like double compession is occurring:

This command gives plain css (no accept-encoding, should not give a compressed response at all):
curl http://5.44.17.43/skin/frontend/enterprise/mdtheme/css/A.styles.css.pagespeed.cf.a5tJl_nEYZ.css | gunzip -
 
This commands needs to inflate twice to get proper css: 

curl -H "Accept-Encoding:gzip" http://5.44.17.43/skin/frontend/enterprise/mdtheme/css/A.styles.css.pagespeed.cf.a5tJl_nEYZ.css | gunzip - | gunzip -

Small chance, but do you by chance have"pagespeed CustomFetchHeader Accept-Encoding gzip;" in your nginx.conf?


Peter Smith

unread,
Jan 15, 2015, 6:45:14 PM1/15/15
to ngx-pagesp...@googlegroups.com
Ah-hah that's it! Commenting that out solved the problem, and I've also just read your post on github about it. I wonder why this isn't happening on my live server.
Reply all
Reply to author
Forward
0 new messages