By Jannik L. on Sunday, 28 September 2014
Posted in General Issues
Likes 0
Views 0.9K
Votes 0
Hey guys when I enable pagespeed and cdn I get this weird error: Uncaught SyntaxError: Unexpected identifier on easysocial-1.3.6.static.min.js?1411680268:6

As I have had this working perfectly in the past, I suspect that something that was changed in the lastest version of easysocial-1.3.6.static.min.js causes Rewrite_Javascript in mod_pagespeed to break it.

NOTE: I have temporarily disabled Rewrite_Javascript to solve this problem temporarily.
server {
listen 23.239.10.236;

server_name statusselect.com http://www.statusselect.com;
server_name_in_redirect off;
pagespeed on;
pagespeed MapProxyDomain statusselect.cachefly.net
statusselect.com;
pagespeed MapRewriteDomain http://statusselect.cachefly.net *statusselect.com;
pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters collapse_whitespace,remove_comments,insert_ga,make_google_analytics_async,sprite_images,insert_image_dimensions;



pagespeed DisableFilters combine_css;



pagespeed AnalyticsID <UA-51891309-1>;


pagespeed Disallow "*/plugins/cometchat/*";




# This is a temporary workaround that ensures requests for pagespeed
# optimized resources go to the pagespeed handler.
location ~ ".pagespeed.([a-z].)?[a-z]{2}.[^.]{10}.[^.]+" { }
location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }

pagespeed FileCachePath /var/ngx_pagespeed_cache;

access_log /var/log/virtualmin/statusselect.com_access_log;
error_log /var/log/virtualmin/statusselect.com_error_log;

location ~* ^/assets/ {
expires 1y;
add_header Cache-Control public;

if ($request_filename ~* ^.*?\.(eot)|(ttf)|(woff)|(svg)|(otf)$){
add_header Access-Control-Allow-Origin *;
}
break;
}


root /srv/http/statusselect-com/public_html;
index index.php index.html index.htm default.html default.htm;
# Support Clean (aka Search Engine Friendly) URLs
location / {
try_files $uri $uri/ /index.php?$args;
}

# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}

location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 600;
}

# caching of files

# CSS and JavaScript : 1 week

location ~* \.(css|js)$ {
access_log off; log_not_found off;
expires 1w;
}


# Image files : 1 month

location ~* \.(bmp|gif|jpg|jpeg|jp2|png|svg|tif|tiff|ico|wbmp|wbxml|smil)$ {
access_log off; log_not_found off;
expires 1M;
}


# Document files : 1 month

location ~* \.(pdf|txt|xml)$ {
access_log off; log_not_found off;
expires 1M;
}


# Audio files : 1 month

location ~* \.(mid|midi|mp3|m4a|m4r|aif|aiff|ra|wav|voc|ogg)$ {
access_log off; log_not_found off;
expires 1M;
}


# Video files : 1 month

location ~* \.(swf|vrml|avi|mkv|mpg|mpeg|mp4|m4v|mov|asf)$ {
access_log off; log_not_found off;
expires 1M;
}
location ~* \.(eot|otf|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}

fastcgi_read_timeout 60;
}
·
Sunday, 28 September 2014 17:42
·
0 Likes
·
0 Votes
·
0 Comments
·
I have attached login for SFTP, SSH, Virtualmin, Cachefly, Admin... my nginx config file that has the pagespeed settings and everything. Just incase you need to access something while diagnosing
·
Sunday, 28 September 2014 17:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Rewrite_javascript in ngx_pagespeed (Mod_pagespeed on NGINX) seems to break EasySocial. This didn't happen in previous versions... so I have temporarily disabled it. Feel free to enable it in my nginx config file for statusselect.com or ask me to re-enable it if needed.
·
Sunday, 28 September 2014 18:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jannik, have you tried disallowing just that script?

ModPagespeedDisallow "filepath/file.js"
Ken
·
Tuesday, 30 September 2014 20:29
·
0 Likes
·
0 Votes
·
0 Comments
·
No, I have not. But I am sure it would fix the problem. It is however the biggest JS file on the server, so it would be great if I could compress it. It shaves a second or two off of load time when I do.
·
Tuesday, 30 September 2014 20:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jannik,

The scripts in EasySocial is actually already compressed and there's actually no point compressing it again? Not really sure why you want to compress it again though.
·
Wednesday, 01 October 2014 02:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Good point. All I know is with Rewrite_Javascript enabled I can get the activity stream down to 3-4 seconds.. but without it it is 5-6 seconds. But I will try to exclude ES, and just run it for the rest of the stuff.
·
Wednesday, 01 October 2014 03:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jannik,

The issue appears to be how Pagespeed had issues recompressing scripts that has lines with long characters.
We reuploaded another version of "easysocial-1.3.6.static.min.js" where there is a linebreak approx. every 512 characters on your site and Pagespeed seems to be recompressing just fine now.

Here are the list of changes we did while fixing this issue:
1. Replaced "easysocial-1.3.6.min.js" with the 512-linebreak version as mentioned above. (Original file renamed to "easysocial-1.3.6.min.js.original".)
2. Enabled mod_pagespeed on your nginx config file.
3. Cleared cache on both pagespeed and cachefly.

Anyway, thanks for providing the testbed. It is an invaluable experience for both of us. We will look into updating our builder to compress script with linebreaks for future versions.
·
Wednesday, 01 October 2014 15:16
·
0 Likes
·
0 Votes
·
0 Comments
·
WOW! Fantastic news, Jensen! Thank you, Thank you, Thank you

P.S. over the next month, feel free to test, tweak, change, break whatever you want related to any part of my build. It is an unconventional build, so if there is something you want to test on it, feel free

P.P.S combine_css breaks Wanderes, so maybe you could suggest to the Wanderers team to test it with mod_pagespeed too
·
Wednesday, 01 October 2014 18:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Jannik
·
Thursday, 02 October 2014 13:41
·
0 Likes
·
0 Votes
·
0 Comments
·
Quick question, I see version 1.3.7 is out. Does that have the needed linebreaks to work with mod pagespeed or should I wait a bit to update?
·
Friday, 03 October 2014 20:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jannik,

It doesn't have that linebreaks fix yet as we need to modify our builder to accommodate this.
·
Saturday, 04 October 2014 13:08
·
0 Likes
·
0 Votes
·
0 Comments
·
Ah, that is what I thought. Any idea of when the fix will be implemented? and how will I be informed? Will be be in the changelog or?
·
Saturday, 04 October 2014 21:38
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Jannik,

Our hands are pretty full right now, we'll see if we can do something about this next week
·
Monday, 06 October 2014 00:44
·
0 Likes
·
0 Votes
·
0 Comments
·
I appreciate you following up with me on this. I understand that you are busy, and appreciate all your hard work. I look forward to better mod_pagespeed compatibility, as I think it is one of the best tools available for making EasySocial based sites fast. Please keep me updated on this.
·
Monday, 06 October 2014 04:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Noted, will keep you updated
·
Monday, 06 October 2014 12:00
·
0 Likes
·
0 Votes
·
0 Comments
·
subscribe
·
Tuesday, 18 November 2014 17:02
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post