1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

External JS (Static/Cookie Free Domain)

Discussion in 'XenForo Questions and Support' started by Jeremy P, May 30, 2011.

  1. Jeremy P

    Jeremy P Well-Known Member

    In 1.0.1 there was an option to set a domain to serve jQuery from. It was said that the approach would be changed in 1.0.2, so that it would load more things from the static domain (such as avatars).

    I can't find the new option (maybe I'm looking in the right place?), surely it's there, as on XF.com avatars are being served from http://xenforo.net?

    If anyone could point me in the right direction I'd appreciate it.
     
  2. Mike

    Mike XenForo Developer Staff Member

    jQuery still has an option to use a CDN. However, the external URL options were moved to library/config.php, as they require some manual moving of stuff to work:
    Code:
    $config['externalDataUrl'] = 'http://xenforo.net/community/data';
    $config['javaScriptUrl'] = 'http://xenforo.net/community/js';
    
     
    DRE and Jeremy P like this.
  3. Jeremy P

    Jeremy P Well-Known Member

    Whoops, I had meant javascript not jQuery, I must be tired :)
    I have a cname that redirects to the original domain if the request is not a static resource, already serving style images from it.

    I would think those two config options should work for me without much hassle. Thanks Mike.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    These two settings need to correspond, right?

    Code:
    $config['externalDataUrl']
    $config['externalDataPath']
    
    Data is written to the path and requested from the URL?

    How did you configure this on xenforo.com? Rsync?
     
    EQnoble likes this.
  5. Mike

    Mike XenForo Developer Staff Member

    Correct.

    No, xenforo.net actually points to the same path as xenforo.com (on the same server). An option would be to use a CDN then that comes back to the original server for the requests. One of the advantages of using xenforo.net is that it's a "cookieless domain", so that does shrink request size a bit.

    Mostly though, it serves as a test bed to make sure the remote loading is working. The advantages (in our particular usage here) are negligible, and there could be some disadvantages (extra DNS lookup and connection, though the separate connection itself can be a benefit).
     
    EQnoble, Jeremy P, Kier and 1 other person like this.
  6. glorify

    glorify Well-Known Member

    Jake, if I am trying to do step 6 and 7 here, what exactly would I do?
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That has nothing to do with the post you quoted. Those steps are instructing you to move your javascript and images to a cookie-free domain.
     
  8. glorify

    glorify Well-Known Member

    Yes, that's what I'm trying to do, but if I move the js folder, I wouldn't have to move the data folder as well, as in Mikes post, would I?
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Nope. You don't need to move data for that.
     
  10. glorify

    glorify Well-Known Member

    You da man. I figured you would know. You have a smart aura surrounding your posts ;)
     
  11. ChemicalKicks

    ChemicalKicks Well-Known Member

    Mike,

    Has this changed with 1.1, attachments are falling to upload for me using a static domain to serve up as per your example.
     
  12. DRE

    DRE Well-Known Member

    Does this still work for you or did you have to try something else?
     
  13. AzzidReign

    AzzidReign Well-Known Member

    That should work just fine. This is what I have:
    Code:
    // CDN
    $config['externalDataUrl'] = 'http://data.se7ensins.com';
    $config['javaScriptUrl'] = 'http://javascript.se7ensins.com/';
     
    DRE likes this.
  14. DRE

    DRE Well-Known Member

    Thanks!
     
  15. DRE

    DRE Well-Known Member

    Oh wait.... Is your data folder like a regular xenforo folder inside xenforo or did you make it a subdomain?
     
  16. AzzidReign

    AzzidReign Well-Known Member

    If I remember correctly, I set my subdomain cname to my CDN and so that code above is telling xf to grab from my cdn.
     

Share This Page