• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Xenforo enabling CDN for static content and javascript - DONE

p4guru

Well-known member
#1
Seems like I stumbled across this as I don't think anyone has mentioned the option_javaScriptSource option to specify CDN url for javascript yet ? I got it working on my test forum (registrations closed for now) http://cache.xenassist.me/threads/xenforo-enabling-cdn-for-static-content-and-javascript.26/

AdminCP -> Options -> Performance -> option_javaScriptSource

[B][IMG]http://xenassist.me/screenshots/xf101_install/styles/styleproperties/xenforo_v101_stylesproperties_0001cdn.png[/IMG][/B]

[B][IMG]http://xenassist.me/screenshots/xf101_install/admin/xenforo_v101_admin_options_005_performance_cdn.png[/IMG]
[/B]
 

p4guru

Well-known member
#2
Just no central path for smilies images ? Guess xenforo forums here already doing this with xenforo.net but no one mentioned it ?
 

Kier

XenForo Developer
Staff member
#3
Note that the JavaScript source option has been removed in 1.0.2, and replaced with a new config variable, together with a new external data URL config variable, allowing us to also serve avatars and attachment thumbnails from a different source.

This is in the config file for xenforo.com:
PHP:
// Requires XenForo 1.0.2
$config['externalDataUrl'] = 'http://xenforo.net/community/data';
$config['javaScriptUrl']   = 'http://xenforo.net/community/js';
 

p4guru

Well-known member
#4
Awesome Kier should make it easier to configure.

While you're at, what about serving attachments from a separate server ? It's always been something the big vB forum folks want to do. I have a vB client who's attachment size is 105GB :eek: <-- love the smiley !
 

Kier

XenForo Developer
Staff member
#5
While you're at, what about serving attachments from a separate server ? It's always been something the big vB forum folks want to do.
At present doing that is not really practical, as attachments require full access to the user authentication system, which requires cookies etc. On a forum where attachments are entirely public it might be something that we could investigate in the future.
 

Rudy

Well-known member
#7
When I was working on our big board vB a couple of years ago, I tried using a CDN for images. It worked well when I used the replacement variables feature, and changed a couple of other settings. I did not notice much of a drop in bandwidth, but images were indeed being served up by the CDN properly. (If I recall from the foggy recesses of my mind, it was a Mirror Bucket at SimpleCDN...?)

However, someone (not sure if it was a fellow web hosting "neighbor" or fellow member on vB.org) mentioned that this should also be possible using rewrites in htaccess. I was not able to get it to work (I had limited time available and my Apache skills were rusty), but theoretically it should be possible. If it worked, it would possibly be an easier alternative, although the additional load on Apache would be debatable.
 

p4guru

Well-known member
#8
Well there's no need for rewrites now that Kier has made it available in app.

Would be nice to have one simple settings page for CDN where a flick of a switch, turns all paths to CDN url

i.e.

CDN menu
enable CDN = yes/no
path to jquery source = / checkbox to enable/disable
path to images source = / checkbox to enable/disable
path to smilies source = / checkbox to enable/disable
path to editor images source = / checkbox to enable/disable
path to avatars source = / checkbox to enable/disable

allow manually defined paths as you might want to setup different CDN hostnames for each
 

Ryan Kent

Well-known member
#9
Note that the JavaScript source option has been removed in 1.0.2, and replaced with a new config variable, together with a new external data URL config variable, allowing us to also serve avatars and attachment thumbnails from a different source.

This is in the config file for xenforo.com:
PHP:
// Requires XenForo 1.0.2
$config['externalDataUrl'] = 'http://xenforo.net/community/data';
$config['javaScriptUrl']  = 'http://xenforo.net/community/js';
What are the advantages vs drawbacks of using a different URL such as www.xenforo.net as opposed to a subdomain such as static.xenforo.com. I would like to optimize my site and am running into these questions currently.
 

Kier

XenForo Developer
Staff member
#10
What are the advantages vs drawbacks of using a different URL such as www.xenforo.net as opposed to a subdomain such as static.xenforo.com. I would like to optimize my site and am running into these questions currently.
As we run our site at http://xenforo.com rather than the www subdomain, I couldn't remember if cookies attached to the root domain would also be accessible to all subdomains, so I just set it up on xenforo.net, which is an entirely different domain.

With hindsight, I could have checked, but I fancied making use of xenforo.net anyway.
 

p4guru

Well-known member
#11
From my experience cookies do attach to subdomains off the main domain. So different extension helps, although can play havok with end user usability if they have ad/flash/blockers which didn't allow the different extension through by default.
 

Ryan Kent

Well-known member
#14
isn't it just what's shown in the 2nd image in the first post of this thread? You set it up as local, but then provide the info for your CDN for option_JavaScriptSource?
 

glorify

Well-known member
#18
Note that the JavaScript source option has been removed in 1.0.2, and replaced with a new config variable, together with a new external data URL config variable, allowing us to also serve avatars and attachment thumbnails from a different source.

This is in the config file for xenforo.com:
PHP:
// Requires XenForo 1.0.2
$config['externalDataUrl'] = 'http://xenforo.net/community/data';
$config['javaScriptUrl']  = 'http://xenforo.net/community/js';
These lines are not in 1.0.3?