Support Forum
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 @spsupport 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.
File on Host Server
File on CDN
Script Failure Warnings
Character Encoding Warning
Simple: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.
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.
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 **/
Simple: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.
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.
Simple: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.
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?
Simple: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.
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.
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!
Simple: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.
1 Guest(s)