External JS (Static/Cookie Free Domain)

Jeremy P

XenForo developer
Staff 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.
 
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';
 
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.
 
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?
 
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).
 
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?
 
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.
 
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?
 
Top Bottom