Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

combine_javascript ReferenceError #558

Open
GoogleCodeExporter opened this issue Apr 6, 2015 · 30 comments
Open

combine_javascript ReferenceError #558

GoogleCodeExporter opened this issue Apr 6, 2015 · 30 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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

  • Changed state: RequestClarification

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

Ouch, I am getting a 503 on the website..

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

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

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

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

Yes - I saw this in Firefox and Google Chrome

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

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

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

  • Changed state: RequestClarification

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

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

  • Changed title: combine_javascript ReferenceError
  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

/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
Copy link
Author

Steven: what version of MPS are you running?

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

@GoogleCodeExporter
Copy link
Author

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

@Nodens2k
Copy link

Nodens2k commented May 7, 2015

Hi there,

We are also experiencing the same problem in our websites. The filter worked perfectly (for us) with Apache 2.2, but we had to disable it after upgrading to Apache 2.4.

In our case, the web site is in a test environment with only one apache server, and no load balancer, proxy or caching layer on top of it.

The javascript errors do not depend on the browser, and they appear just a few seconds after restarting the server. It's always the same, the combined javascript defines a set of variables, but the names used in the HTML do not match.

The combined javascript is downloaded complete, it is not cut off.

Could it be some incompatibility with the OS or Apache? We are running the following configuration:

X-Mod-Pagespeed: 1.9.32.3-4448
Apache Version: 2.4.12 (Ubuntu)
Host OS: Ubuntu 12.04.5 LTS

Single quad-core server with 8GB RAM

/proc/cpuinfo (repeated for each core):

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 37
model name      : Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
stepping        : 1
microcode       : 0x416
cpu MHz         : 2800.000
cache size      : 25600 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm ida arat pln pts dtherm
bogomips        : 5600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants