• 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)

Jeremy P

Well-known member
#1
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.
 

Mike

XenForo developer
Staff member
#2
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';
 

Jeremy P

Well-known member
#3
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.
 

Jake Bunce

XenForo moderator
Staff member
#4
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';
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?
 

Mike

XenForo developer
Staff member
#5
Data is written to the path and requested from the URL?
Correct.

How did you configure this on xenforo.com? Rsync?
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).
 

glorify

Well-known member
#6
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?
Jake, if I am trying to do step 6 and 7 here, what exactly would I do?
 

glorify

Well-known member
#8
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.
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?
 

ChemicalKicks

Well-known member
#11
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';
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.
 

DRE

Well-known member
#15
That should work just fine. This is what I have:
Code:
// CDN
$config['externalDataUrl'] = 'http://data.se7ensins.com';
$config['javaScriptUrl'] = 'http://javascript.se7ensins.com/';
Oh wait.... Is your data folder like a regular xenforo folder inside xenforo or did you make it a subdomain?