A A A
Forum Scope


Match



Forum Options



Min search length: 3 characters / Max search length: 84 characters
Forum Login
Lost password?
general-topic
Odd Encoding of Scripts served via CDN
Avatar
jim
Here and Now

630 Posts
(Offline)
1
Apr 27, 2019 - 4:43 pm
Print

I’m not certain character encoding is the correct term, but something is happening to sp scripts when we attempt to serve them up via CDN.

We are desperately trying to get the Hummingbird site optimization plugin working with Simplepress. It handles caching, gzip, and asset optimization among other things. I’ve got it working well for all our CSS files, and most scripts on our site, but we encounter an issue with SimplePress scripts when activating its CDN function.

I have a lengthy support topic going on with the Hummingbird devs, but while I await further answers I wanted to share this here to see if the @Simple Press experts have any insight.

Please compare the two screenshots, viewing the source of sp-forum.min.js. This is just one example, of what I think is causing all forum functions to fail with the CDN active.

One shows the clean script code hosted on our server, viewed via cPanel. The second shows the same file hosted on the CDN. Notice the odd characters.

I have combining and caching turned off in Simplepress for js and css, as this has been working well to let Hummingbird do that. No problems with CSS files!

I have also cleared all SP cache (css, script, xml, and general). This issue only presents itself when turning on the CDN, without any further combining or minification of individual files.

I say “character encoding” because we also get this warning in the browser:

The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

Even though, we do have the charset=”UTF-8″ meta tag in our site header. I read this warning can come from specific files (e.g.; scripts) and not necessarily the HTML.

Thanks in advance for any possible feedback.

 

spscript-local.pngImage Enlarger

File on Host Server

spscript-cdn-2.pngImage Enlarger

File on CDN

script-errors.pngImage Enlarger

Script Failure Warnings

charset.pngImage Enlarger

Character Encoding Warning

Attachments

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Simple Press
389 Posts
(Offline)
2
Apr 27, 2019 - 11:46 pm
Print

That’s interesting – looks like the CDN is trying to do some optimization of its own and is corrupting the file.  Not sure what CDN you’re using but we use cloudflare and don’t encounter any issues like this.

Also, do not let any caching plugin (including hummingbird) combine the css and js scripts.

Another thing you you might try is to turn on the SP_SCRIPT_DEBUG flag in wp-config and set it to true – that should serve up mostly the non minified version of the scripts – see if that helps.

Thanks.

Building out your membership site can be a lot of work. Easy Membership Sites has pre-configured all the Simple:Press plugins and tools you need to build a complete membership site in a fraction of the usual time. Check them out: Easy Membership Sites

Avatar
jim
Here and Now

630 Posts
(Offline)
3
Apr 28, 2019 - 2:51 pm
Print

Thanks for the feedback!

This is rather puzzling, and I continue troubleshooting since of the 65+ scripts loading with our theme and various plugins, the only scripts files that are causing any issues when served up via the CDN are all related to SimpePress…

List of scripts HB Breaks:
/**handles: spforum **/
/**handles: spforumevents **/
/**handles: sfprintthis **/
/**handles: spabjs **/
/**handles: sp-pm **/
/**handles: sp-subscriptions **/
/**handles: jquery.msdropdown **/
/**handles: spforumfooter **/

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Simple Press
389 Posts
(Offline)
4
Apr 28, 2019 - 2:59 pm
Print

Yeah, that is weird. I can’t even hazard a guess as to what could be happening.  They’re just standard text files…

Building out your membership site can be a lot of work. Easy Membership Sites has pre-configured all the Simple:Press plugins and tools you need to build a complete membership site in a fraction of the usual time. Check them out: Easy Membership Sites

Avatar
jim
Here and Now

630 Posts
(Offline)
5
Apr 28, 2019 - 3:02 pm
Print

Simple Press said
you might try is to turn on the SP_SCRIPT_DEBUG flag in wp-config and set it to true…

Which is it?

SP_SCRIPT_DEBUG

OR

SP_SCRIPTS_DEBUG

The latter is defined in the SP docs.

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Simple Press
389 Posts
(Offline)
6
Apr 28, 2019 - 3:04 pm
Print

Sorry, you’re right – its SP_SCRIPTS_DEBUG not SP_SCRIPT_DEBUG.

sp_Check
This post answers the topic

Building out your membership site can be a lot of work. Easy Membership Sites has pre-configured all the Simple:Press plugins and tools you need to build a complete membership site in a fraction of the usual time. Check them out: Easy Membership Sites

Avatar
jim
Here and Now

630 Posts
(Offline)
7
May 1, 2019 - 11:05 am
Print

Simple Press said
…do not let any caching plugin (including hummingbird) combine the css and js scripts. 

For the record – and for anyone else ever using Hummingbird – this was the only way we could get SP scripts working when minified and served up via the WPMU Dev CDN: by turning off CSS/JS Combined Caching via the SP Admin, and defining SP_SCRIPTS_DEBUG in wp-config.

So…thanks for that little hack! Are there any negative impacts of using that wp-config edit? In terms of performance or security?

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Avatar
Simple Press
389 Posts
(Offline)
8
May 1, 2019 - 1:24 pm
Print

Since the scripts are not minified, it will take slightly longer to download and slightly longer for the browser to parse them.  It is possible that the CDN will compress them before sending them to the browser but I have no way of knowing that for sure.  Still, I doubt that most users running on modern hardware would experience an impact that is measurable.

Building out your membership site can be a lot of work. Easy Membership Sites has pre-configured all the Simple:Press plugins and tools you need to build a complete membership site in a fraction of the usual time. Check them out: Easy Membership Sites

Avatar
jim
Here and Now

630 Posts
(Offline)
9
May 1, 2019 - 2:03 pm
Print

Simple Press said
It is possible that the CDN will compress them before sending them to the browser…

FYI: Yes, Humming bird minifies the assets and serves up cached css and scripts from the CDN.

So far, so good.

Thanks again!

TripawdsSimple:Press powers the Tripawds Discussion Forums.

It's better to hop on three legs than to limp on four.

The Tripawds Blogs Community is made possible by The Tripawds Foundation.

Forum Timezone: America/New_York
All RSSShow Stats
Administrators: Blues Dancer, Simple Press, SP Community Support
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 630
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Newest Members:
James Smith
Martin Brothers
Arti Singh
Abdulaziz alghthbar
Tim Castillo
Kaspalita Thompson
Martin Kolář
Forum Stats:
Groups: 7
Forums: 17
Topics: 10059
Posts: 79348

 

Member Stats:
Guest Posters: 607
Members: 16900
Moderators: 0
Admins: 3

Most Users Ever Online
499
Currently Online
Guest(s)
26
Currently Browsing this Page

1 Guest(s)