1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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

Discussion in 'Tips and Guides [Archive]' started by p4guru, Apr 13, 2011.

  1. p4guru

    p4guru Well-Known Member

    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]
     
    Brandon Sheley likes this.
  2. p4guru

    p4guru Well-Known Member

    Just no central path for smilies images ? Guess xenforo forums here already doing this with xenforo.net but no one mentioned it ?
     
  3. Kier

    Kier XenForo Developer Staff Member

    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';
     
    Eagle, Marcus, DarkSign and 5 others like this.
  4. p4guru

    p4guru Well-Known Member

    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 !
     
    Brandon Sheley likes this.
  5. Kier

    Kier XenForo Developer Staff Member

    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.
     
    BamaStangGuy likes this.
  6. p4guru

    p4guru Well-Known Member

    Ah i see.. fingers crossed then for the future :)
     
  7. Rudy

    Rudy Well-Known Member

    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.
     
  8. p4guru

    p4guru Well-Known Member

    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
     
  9. Ryan Kent

    Ryan Kent Well-Known Member

    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.
     
  10. Kier

    Kier XenForo Developer Staff Member

    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.
     
  11. p4guru

    p4guru Well-Known Member

    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.
     
  12. cmeinck

    cmeinck Well-Known Member

    I'm using MaxCDN. Any suggestions on edits to the /library/config.php file to allow my CDN to handle various javascripts.
     
    Andy.N likes this.
  13. Andy.N

    Andy.N Well-Known Member

    Same here ^^
     
  14. Ryan Kent

    Ryan Kent Well-Known Member

    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?
     
  15. Andy.N

    Andy.N Well-Known Member

    Read Kier's post. We will have to see how 1.0.2 sets up.
     
  16. p4guru

    p4guru Well-Known Member

  17. Forsaken

    Forsaken Well-Known Member

  18. glorify

    glorify Well-Known Member

    These lines are not in 1.0.3?
     
  19. Forsaken

    Forsaken Well-Known Member

    I think you have to add them yourself.
     
    a legacy reborn likes this.
  20. glorify

    glorify Well-Known Member

    I tried moving the js by adding the line, but I was getting all kinds of weird things happening.
     

Share This Page