crowell / modpagespeed_tmp

Automatically exported from code.google.com/p/modpagespeed
Apache License 2.0
0 stars 0 forks source link

combine_javascript ReferenceError #558

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have only just noticed this on my website, using the latest ModPagespeed.

Javascipt fails on my modded version of jquery.tablesorter.pager.js - 
http://www.sellmyretro.com/themes/enuukGreen/js/jquery.tablesorter.pager.js

I cannot find any particular errors in the javascript unless i am missing 
something - JSLint does not throw up anything too major

Any ideas - this may help others with issues with javascript when compressed 
with modpagespeed

Original issue reported on code.google.com by rwap.services on 7 Nov 2012 at 12:00

GoogleCodeExporter commented 9 years ago
Can you be more specific about what you mean by "javascript fails"?  Do you see 
errors in Firebug, or do you have some kind of functional inconsistency?

What mod_pagespeed filters do you have enabled?

If you add this directive will it work around the problem:
  ModPagespeedDisallow */jquery.tablesorter.pager.js

Did it previously work before you edited that file?

Original comment by jmara...@google.com on 7 Nov 2012 at 12:34

GoogleCodeExporter commented 9 years ago

Original comment by jmara...@google.com on 7 Nov 2012 at 12:34

GoogleCodeExporter commented 9 years ago
The error I got with modpagespeed is:

SyntaxError: unterminated string literal
in the line:
var mod_pagespeed_OjHQ0dlBm9 = 
"(function($){$.extend({tablesorter:new\nfunction(){var 
parsers=[],widgets=[];this.defaults={cssHeader:\"header\",cssAsc:\"headerSortUp\
",cssDesc:\"headerSortDown\",cssChildRow:\"expand-child\",sortInitialOrder:\"asc
\",sortMultiSortKey:\"shiftKey\",sortForce:null,sortAppend:null,sortLocaleCompar
e:true,textExtraction:\"simple\",parsers:{},widgets:[],widgetZebra:{css:[\"even\
",\"odd\"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerL
ist:[],dateFormat:\"us\",decimal:'/\\.|\\,/g',onRenderHeader:null,selectorHeader
s:'thead th',debug:false};function benchmark(s,d){log(s+\",\"+(new 
Date().getTime()-d.getTime())+\"ms\");}this.benchmark=benchmark;function 
log(s){if(typeof console!=\"undefined\"&&typeof 
console.debug!=\"undefined\"){console.log(s);}else{alert(s);}}function 
buildParserCache(table,$headers){if(table.config.debug){var 
parsersDebug=\"\";}if(table.tBodies.length==0)return;var 
rows=table.tBodies[0].rows;if(rows[0]){var 
list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var 
p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sor
ter)){p=getParserById($($headers[i]).metadata().sorter);}else 
if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(ta
ble.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}
if(table.config.debug){parsersDebug+=\"column:\"+i+\" 
parser:\"+p.id+\"\\n\";}list.push(p);}}if(table.config.debug){log(parsersDebug);
}return list;};function 
detectParserForColumn(table,rows,rowIndex,cellIndex){var 
l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''
&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(row
s,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.c
onfig.debug){log('Checking if value was empty on 
row:'+rowIndex);}}else{keepLooking=false;}}for(var 
i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return 
parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return 
rows[rowIndex].cells[cellIndex];}function 
trimAndGetNodeText(config,node){return 
$.trim(getElementText(config,node));}function getParserById(name){var 
l=parsers.length;for(var 
i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return 
parsers[i];}}return false;}function 
buildCache(table){if(table.config.debug){var cacheTime=new Date();}var 
totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.
tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.conf
ig.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var 
c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){c
ache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cach
e.row.push(c);for(var 
j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[
0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.nor
malized.push(cols);cols=null;};if(table.config.debug){benchmark(\"Building 
cache for \"+totalRows+\" rows:\",cacheTime);}return cache;};function 
getElementText(config,node){var 
text=\"\";if(!node)return\"\";if(!config.supportsTextContent)config.supportsText
Content=node.textContent||false;if(config.textExtraction==\"simple\"){if(config.
supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.chi
ldNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.in
nerHTML;}}}else{if(typeof(config.textExtraction)==\"function\"){text=config.text
Extraction(node);}else{text=$(node).text();}}return text;}function 
appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var 
c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tabl
eBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var 
pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var 
l=r[pos].length;for(var 
j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){ta
ble.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark(\"Re
built 
table:\",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger(
\"sortEnd\");},0);};function buildHeaders(table){if(table.config.debug){var 
time=new Date();}var meta=($.metadata)?true:false;var 
header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.s
electorHeaders,table).each(function(index){this.column=

It ends rather oddly....

The directive
ModPagespeedDisallow */jquery.tablesorter.pager.js

Does get around this, so that is what made me think it was the issue.

My ModPagespeed.conf file is:

# Attempt to load mod_version if it wasn't loaded or compiled in (eg on Debian)
<IfModule !mod_version.c>
  LoadModule version_module /usr/lib64/httpd/modules/mod_version.so
</IfModule>

<IfVersion < 2.4>
  LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
  LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed_ap24.so
</IfVersion>

# Only attempt to load mod_deflate if it hasn't been loaded already.
<IfModule !mod_deflate.c>
 LoadModule deflate_module /usr/lib64/httpd/modules/mod_deflate.so
</IfModule>
<IfModule pagespeed_module>
    # Turn on mod_pagespeed. To completely disable mod_pagespeed, you
    # can set this to "on".
    ModPagespeed on
    ModPagespeedDisallow            */jquery.tinymce.js
    ModPagespeedDisallow            */tiny_mce.js
    # ModPagespeedDisallow          */jquery.tablesorter.pager.js

    # Direct Apache to send all HTML output to the mod_pagespeed
    # output handler.
    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html

    # The ModPagespeedFileCachePath and
    # ModPagespeedGeneratedFilePrefix directories must exist and be
    # writable by the apache user (as specified by the User
    # directive).
    ModPagespeedFileCachePath            "/var/www/mod_pagespeed/cache/"
    ModPagespeedGeneratedFilePrefix      "/var/www/mod_pagespeed/files/"

    # Override the mod_pagespeed 'rewrite level'. The default level
    # "CoreFilters" uses a set of rewrite filters that are generally
    # safe for most web pages. Most sites should not need to change
    # this value and can instead fine-tune the configuration using the
    # ModPagespeedDisableFilters and ModPagespeedEnableFilters
    # directives, below. Valid values for ModPagespeedRewriteLevel are
    # PassThrough, CoreFilters and TestingCoreFilters.
    #
    ModPagespeedRewriteLevel CoreFilters

    # Explicitly disables specific filters. This is useful in
    # conjuction with ModPagespeedRewriteLevel. For instance, if one
    # of the filters in the CoreFilters needs to be disabled for a
    # site, that filter can be added to
    # ModPagespeedDisableFilters. This directive contains a
    # comma-separated list of filter names, and can be repeated.
    #
    # ModPagespeedDisableFilters rewrite_javascript

    # Explicitly enables specific filters. This is useful in
    # conjuction with ModPagespeedRewriteLevel. For instance, filters
    # not included in the CoreFilters may be enabled using this
    # directive. This directive contains a comma-separated list of
    # filter names, and can be repeated.
    #
    # ModPagespeedEnableFilters collapse_whitespace,elide_attributes
    # ModPagespeedEnableFilters collapse_whitespace,elide_attributes,outline_css,outline_javascript
    ModPagespeedEnableFilters collapse_whitespace,outline_css,outline_javascript,rewrite_javascript
    ModPagespeedEnableFilters combine_css,rewrite_css,elide_attributes,rewrite_style_attributes
    ModPagespeedEnableFilters make_google_analytics_async,combine_javascript
    ModPagespeedEnableFilters move_css_above_scripts,remove_comments,sprite_images

    # ModPagespeedDomain
    # authorizes rewriting of JS, CSS, and Image files found in this
    # domain. By default only resources with the same origin as the
    # HTML file are rewritten. For example:
    #
    #   ModPagespeedDomain cdn.myhost.com
    #
    # This will allow resources found on http://cdn.myhost.com to be
    # rewritten in addition to those in the same domain as the HTML.
    #
    # Wildcards (* and ?) are allowed in the domain specification. Be
    # careful when using them as if you rewrite domains that do not
    # send you traffic, then the site receiving the traffic will not
    # know how to serve the rewritten content.

    ModPagespeedDomain www.sellmyretro.com
    ModPagespeedDomain sellmyretro.com

    ModPagespeedMapOriginDomain http://www.sellmyretro.com https://www.sellmyretro.com

    # Other defaults (cache sizes and thresholds):
    ModPagespeedFileCacheSizeKb          102400000
    # ModPagespeedFileCacheCleanIntervalMs 3600000
    # ModPagespeedLRUCacheKbPerProcess     1024
    # ModPagespeedLRUCacheByteLimit        16384
    # ModPagespeedCssInlineMaxBytes        2048
    # ModPagespeedImgInlineMaxBytes        2048
    # ModPagespeedJsInlineMaxBytes         2048
    # ModPagespeedCssOutlineMinBytes       3000
    # ModPagespeedJsOutlineMinBytes        3000

    # Image formatting
    # Bound the number of images that can be rewritten at any one time; this
    # avoids overloading the CPU.  Set this to 0 to remove the bound.
    ModPagespeedEnableFilters insert_image_dimensions
    ModPagespeedEnableFilters inline_images
    ModPagespeedEnableFilters convert_jpeg_to_webp
    ModPagespeedEnableFilters resize_mobile_images
    ModPagespeedEnableFilters convert_jpeg_to_progressive
    ModPagespeedEnableFilters move_css_above_scripts
    ModPagespeedEnableFilters extend_cache
    ModPagespeedEnableFilters inline_preview_images

    ModPagespeedImgMaxRewritesAtOnce        10

    # ERROR TESTING - ISSUE NUMBER 349
    ModPagespeedListOutstandingUrlsOnError  on 

    # When Apache is set up as a browser proxy, mod_pagespeed can record
    # web-sites as they are requested, so that an image of the web is built up
    # in the directory of the proxy administrator's choosing.  When ReadOnly is
    # on, only files already present in the SlurpDirectory are served by the
    # proxy.
    # ModPagespeedSlurpDirectory ...
    # ModPagespeedSlurpReadOnly on

    # The maximum URL size is generally limited to about 2k characters
    # due to IE: See http://support.microsoft.com/kb/208427/EN-US.
    # Apache servers by default impose a further limitation of about
    # 250 characters per URL segment (text between slashes).
    # mod_pagespeed circumvents this limitation, but if you employ
    # proxy servers in your path you may need to re-impose it by
    # overriding the setting here.  The default setting is 1024
    # characters.
    #
    # ModPagespeedMaxSegmentLength 250

    # Uncomment this if you want to prevent mod_pagespeed from combining files
    # (e.g. CSS files) across paths
    #
    # ModPagespeedCombineAcrossPaths off

    # Load from file rather than http where possible - static files only
    ModPagespeedLoadFromFile "http://www.sellmyretro.com/themes/mails/" "/var/www/html/themes/mails/"
    ModPagespeedLoadFromFile "http://www.sellmyretro.com/uploaded/img/" "/var/www/html/uploaded/img/"
    # ModPagespeedLoadFromFile "http://www.sellmyretro.com/themes/enuukGreen/" "/var/www/html/themes/enuukGreen/"

    ModPagespeedFetchWithGzip on
    SetOutputFilter DEFLATE

    # Enables server-side instrumentation and statistics.  If this rewriter is
    # enabled, then each rewritten HTML page will have instrumentation javacript
    # added that sends latency beacons to /mod_pagespeed_beacon.  These
    # statistics can be accessed at /mod_pagespeed_statistics.  You must also
    # enable the mod_pagespeed_statistics and mod_pagespeed_beacon handlers
    # below.
    #
    # ModPagespeedEnableFilters add_instrumentation

    # Uncomment the following line so that ModPagespeed will not cache or
    # rewrite resources with Vary: in the header, e.g. Vary: User-Agent.
    # ModPagespeedRespectVary on

    # This handles the client-side instrumentation callbacks which are injected
    # by the add_instrumentation filter.
    # You can use a different location by adding the ModPagespeedBeaconUrl
    # directive; see the documentation on add_instrumentation.
    #
    # <Location /mod_pagespeed_beacon>
    #       SetHandler mod_pagespeed_beacon
    # </Location>

    # This page lets you view statistics about the mod_pagespeed module.
    <Location /mod_pagespeed_statistics>
        Order allow,deny
        # You may insert other "Allow from" lines to add hosts you want to
        # allow to look at generated statistics.  Another possibility is
        # to comment out the "Order" and "Allow" options from the config
        # file, to allow any client that can reach your server to examine
        # statistics.  This might be appropriate in an experimental setup or
        # if the Apache server is protected by a reverse proxy that will
        # filter URLs in some fashion.
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_statistics
    </Location>

    # Page /mod_pagespeed_message lets you view the latest messages from
    # mod_pagespeed, regardless of log-level in your httpd.conf
    # ModPagespeedMessageBufferSize is the maximum number of bytes you would
    # like to dump to your /mod_pagespeed_message page at one time,
    # its default value is 100k bytes.
    # Set it to 0 if you want to disable this feature.

    ModPagespeedMessageBufferSize 100000

    # mod_pagespeed has the ability to collect statistics about page visits as
    # well as page, resource, and div location (see div_structure_filter)
    # referrals.  These will eventually be used to speed up pages with at least
    # resource pre-fetch, if not Chrome's new pre-render, technology.  See
    # googlewebmastercentral.blogspot.com/2011/06/announcing-instant-pages.html
    #   We recommend enabling the div_structure filter if turning on statistics
    # collection below.  Enabling the div_structure filter will increase the
    # effectiveness of pre-rendering prediction, because it will take into
    # account both URLs and page locations when aggregating user click through
    # behavior.  To enable the div_structure filter, uncomment the appropriate
    # line below or add div_structure to the enabled filters at the top of this
    # configuration file.
    #   Page /mod_pagespeed_referer_statistics lets you view the accumulated
    # referral statistics.
    #   ModPagespeedCollectRefererStatistics on enables collection (default off)
    #   ModPagespeedHashRefererStatistics obscures collected info (default off)
    #   ModPagespeedRefererStatisticsOutputLevel can be changed if the page
    # /mod_pagespeed_referer_statistics is slow to load:
    #   - Organized (default) is the most readable and ordered logically, but
    #       involves computation
    #   - Simple is readable but unordered
    #   - Fast is the fastest and contains all necessary information, but is
    #       fairly unreadable

    # ModPagespeedCollectRefererStatistics on
    # ModPagespeedHashRefererStatistics on
    # ModPagespeedRefererStatisticsOutputLevel Simple
    # ModPagespeedEnableFilters div_structure

    <Location /mod_pagespeed_message>
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_message
    </Location>
    <Location /mod_pagespeed_referer_statistics>
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_referer_statistics
    </Location>
</IfModule>

Original comment by rwap.services on 7 Nov 2012 at 1:45

GoogleCodeExporter commented 9 years ago
Looking at the above, for some reason the error appears in the middle of the 
compressed jquery.tablesorter.js, which is correctly compressed with the 

ModPagespeedDisallow */jquery.tablesorter.pager.js

directive in place

Original comment by rwap.services on 7 Nov 2012 at 1:47

GoogleCodeExporter commented 9 years ago
Matthew can you take a look?

We haven't seen a minify bug in a while but this might be one.  Attaching the 
file now in case it changes at origin.

Original comment by jmara...@google.com on 7 Nov 2012 at 1:52

Attachments:

GoogleCodeExporter commented 9 years ago
This looks fine when run through the standalone minifier (js_minify); it 
frankly looks like file truncation during serving, and the quoted code pretty 
clearly looks like the results of combine_javascript.  Does switching off 
combine_javascript but permitting jquery.tablesorter.pager.js work?

Original comment by jmaes...@google.com on 7 Nov 2012 at 3:02

GoogleCodeExporter commented 9 years ago
Yes - it does look to be an issue with combine_javascript - I have now 
permitted jquery.tablesorter.pager.js and disabled combine_javascript and the 
site works without any issues.

Original comment by rwap.services on 7 Nov 2012 at 3:14

GoogleCodeExporter commented 9 years ago

Original comment by jmaes...@google.com on 7 Nov 2012 at 3:19

GoogleCodeExporter commented 9 years ago
Ouch, I am getting a 503 on the website..

Original comment by morlov...@google.com on 17 Dec 2012 at 2:19

GoogleCodeExporter commented 9 years ago
The 503 error suggests that ZBBlock is blocking your access - I have disabled 
this for now until the issue is resolved (I would need your IP address to check 
why it is blocking you!)

Original comment by rwap.services on 17 Dec 2012 at 2:35

GoogleCodeExporter commented 9 years ago

Original comment by jmara...@google.com on 19 Dec 2012 at 3:35

GoogleCodeExporter commented 9 years ago
Thanks. Seems to combine fine for me, though (when trying locally). Any chance 
you've updated jquery.tablesorter.pager.js since then?

Original comment by morlov...@google.com on 19 Dec 2012 at 6:24

GoogleCodeExporter commented 9 years ago
Yes - I have changed jquery.tablesorter.pager.js a fair bit so you would need 
to download the version from my site.

Original comment by rwap.services on 19 Dec 2012 at 11:09

GoogleCodeExporter commented 9 years ago
Sorry, let me rephrase it: would it be possible to get the version you were 
using at the time you noticed the problem?

Original comment by morlov...@google.com on 19 Dec 2012 at 11:27

GoogleCodeExporter commented 9 years ago
Ah right - actually no, I have not changed the file since 7th November when I 
first opened this ticket

Original comment by rwap.services on 20 Dec 2012 at 12:25

GoogleCodeExporter commented 9 years ago
This error does not depend on this particular js file. I had to disable 
combine_javascript on my website https://www.highdefinition.ch because of this 
error. See the attachment. For some reason, this error occurs only on Firefox 
and not on IE9 and Chrome. If someone could contact me on skype (my real Name 
is unique), I can then temporarly enable that feature again.

Original comment by frederic...@gmail.com on 17 Mar 2013 at 5:22

Attachments:

GoogleCodeExporter commented 9 years ago
btw this error did only show up recently. causes might be a new firefox 
version, new mod_pagespeed version, updated jquery or other javascript file or 
another random change.

Original comment by frederic...@gmail.com on 17 Mar 2013 at 5:24

GoogleCodeExporter commented 9 years ago
Re: comment: #16: thanks for the report. What Firefox version was that in?

At the original reporter: did you notice the problem with Firefox as well?

Original comment by morlov...@google.com on 2 Apr 2013 at 8:13

GoogleCodeExporter commented 9 years ago
Yes - I saw this in Firefox and Google Chrome

Original comment by rwap.services on 8 Apr 2013 at 9:52

GoogleCodeExporter commented 9 years ago
Just as an update - this may be related to the particular size of javascript 
files which are being combined - I edited a javascript file today and after 
uploading the updated file, I saw a similar issue (on another site) - it 
appears that combine_javascript just outputs a combined file which can be 
curtailed (in this particular instance, it ended in the middle of a function 
name!)

As this is on a production server, I cannot justify turning combine_javascript 
back on and reverting to the original file to see if it worked OK.

Original comment by rwap.services on 24 Apr 2013 at 10:34

GoogleCodeExporter commented 9 years ago
It appears that combine_javascript is enabled again on 

https://www.highdefinition.ch/js/jquery-1.10.2.min.js,Mjm.ZzSiN_5Whq.js+jquery-m
igrate-1.2.1.js,Mjm.pE1rtGPryg.js+javascript.js,Mjm.NPRmNN3TDb.js+jquery-ui-1.9.
0.custom.min.js,Mjm.4hCtr3W7CU.js+mbContainer.js,Mjm.ADf0C0Iuf1.js+jquery.tipTip
.js,Mjm.m-1qSmsUzi.js.pagespeed.jc.ECiss2d94J.js

Does that mean this bug is fixed?

Original comment by jmara...@google.com on 13 Nov 2013 at 3:18

GoogleCodeExporter commented 9 years ago
I have seen the above and tried re-enabling combine_javascript on 
www.sellmyretro.com and restarted the httpd server - however, on the page which 
caused the original issue (you need to be a logged on user), I can't see that 
the scripts are being combined....

Perhaps this is because ModPagespeed realises that the scripts would exceed the 
maximum it can handle when combined?

Original comment by rwap.services on 22 Nov 2013 at 9:28

GoogleCodeExporter commented 9 years ago
FYI as of 1.7, combine_javascript is on by default but it's auto-limited to 90k 
bytes per combination.

However, the ReferenceError messsages in comment #16 are a real problem that 
we've seen elsewhere.

There are potentially four things going on here:
  1. Some kind of size-exceeded problem which is avoided via the 90k limit in 1.7
  2. A JavaScript minification bug of some sort.
  3. We have found a deadline-related bug in our handling of combining of minified JS
  4. Changing one of the JS files in a combined/minified set and having a partial cache
     flush

Let's assume #1 is already fixed.  We have efforts underway to address #2, #3, 
and #4.  I'll make each of those blocking issues for this one.

Original comment by jmara...@google.com on 31 Jan 2014 at 1:56

GoogleCodeExporter commented 9 years ago

Original comment by jmara...@google.com on 31 Jan 2014 at 1:59

GoogleCodeExporter commented 9 years ago

Original comment by jmara...@google.com on 31 Jan 2014 at 2:01

GoogleCodeExporter commented 9 years ago

Original comment by jmara...@google.com on 31 Jan 2014 at 2:07

GoogleCodeExporter commented 9 years ago
/js/supersubs.js+hoverIntent.js.pagespeed.jc.FgljhMPFkv.js 
(index):44 Uncaught ReferenceError: mod_pagespeed_qh4HRVMf9L is not defined
(index):45 Uncaught ReferenceError: mod_pagespeed_Hfttuf9x4I is not defined

After a fresh restart of everything there is no issue, but then after a few 
days this happens and causes parts of the site to break.

I will try to turn off combinejavascript and see if that fixes the issue, but 
any advice?

Thanks.

Original comment by steven.f...@gmail.com on 4 Feb 2015 at 11:59

GoogleCodeExporter commented 9 years ago
Steven: what version of MPS are you running?

Original comment by jmara...@google.com on 5 Feb 2015 at 3:24

GoogleCodeExporter commented 9 years ago
X-Page-Speed: 1.9.32.2-4321

Also, this is probably pertinent info.

I have an Amazon Elastic Load Balancer in front and then an EC2 instance behind 
running nginx/1.6.2.

Because I want to run multiple SSL certificates for multiple domains from one 
instance, I had to set the LB and nginx to use "proxy_protocol" so that the LB 
would forward the real IP of the client trying to access the sites.

proxy_protocol has limited documentation, but just incase here is some (it's a 
one line addition to the request that contains the clients IP):
http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt
https://chrislea.com/2014/03/20/using-proxy-protocol-nginx/
http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/enable-pro
xy-protocol.html

Everything on that front works perfectly, but pagespeed keeps causing these 
errors in the error.log of nginx probably because it is not sending the proxy 
protocol line first when it is trying to do whatever it's doing:

" while reading PROXY protocol, client: 172.31.3.39, server: 0.0.0.0:80
2015/02/05 19:04:28 [error] 10123#0: *70810 broken header: "GET 
/wp-content/plugins/fancybox-for-wordpress/fancybox/fancybox.png HTTP/1.1
Host: www.[redacted].com
Referer: http://www.[redacted].com/[redacted]/[redacted]/
PageSpeed: off
User-Agent: Serf/1.1.0 mod_pagespeed/1.9.32.2-4321

" while reading PROXY protocol, client: 172.31.3.39, server: 0.0.0.0:80
2015/02/05 19:04:28 [error] 10123#0: *70811 broken header: "GET 
/wp-content/plugins/fancybox-for-wordpress/fancybox/blank.gif HTTP/1.1
Host: www.[redacted].com
Referer: http://www.[redacted].com/[redacted]/[redacted]/
PageSpeed: off
User-Agent: Serf/1.1.0 mod_pagespeed/1.9.32.2-4321

... etc

I'm assuming this might have something to do with the errors I'm seeing after 
some time regarding the 'is not defined' stuff related the javascript libraries 
when loading a site, but it might be unrelated.

Have you seen this before? Is there a way to have pagespeed add the 
proxy_protocol line to the header to fix these errors when proxy_protocol is 
enabled?

Thank you so much for your help.

Original comment by steven.f...@gmail.com on 5 Feb 2015 at 7:50