How To Serve Javascript and Static Images from Cloudflare CDN

How To Serve Javascript and Static Images from Cloudflare CDN

DRE

Well-known member
8thos submitted a new resource:

How To Serve Javascript and Static Images from Cloudflare CDN (version 1.0) - How to serve your static images and javascript from Cloudflare CDN.

Cloudflare

This basic guide is only for using Cloudflare to deliver our website's static images and javascript. Most of the directions are for cPanel and Xenforo Admin CP. I am using Cloudflare as an example because it's free and usually comes in most shared hosting's cPanel. If you need more in-depth and advanced instructions, ask your host or damoncloudflare.

I will be using my site...

Read more about this resource...
 
I just ran a test for your site and first byte time got a C for me. I wouldn't be discouraged by one test, there are more random factors involved, so try to average them out.
 
Mike says xenforo uses a cookie-less subdomain but he says there is no advantage in the way he uses it.

I wonder how much of an advantage it would used it with a CDN like Cloudflare.

http://xenforo.com/community/threads/external-js-static-cookie-free-domain.16463/#post-217082

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


It would be interesting to see how much xenforo.com's score would raise by experimenting with Cloudflare.

http://www.webpagetest.org/result/120613_YF_D9M/


xenforo.webp
 
We're going to be trying CloudFlare out soon - we're relatively happy to switch the name servers across - is there any reason not to?
 
We're going to be trying CloudFlare out soon - we're relatively happy to switch the name servers across - is there any reason not to?
I mentioned in the resource that sometimes Cloudflare will make your site go offline. That's why I don't switch nameservers. Would you rather your whole site go offline and risk members not being able to access the site at all and always having to go through challenge pages to access your site or would you rather just speed up the site only using resources that can easily be switched back to your own server in case something goes wrong with Cloudflare?
 
The challenge pages are only related to the security features which we're switching off so that's not an issue.

You're right, though, about the dependence on them and their reliability. I will look into it a bit further.

Cheers.
 
The challenge pages are only related to the security features which we're switching off so that's not an issue.

You're right, though, about the dependence on them and their reliability. I will look into it a bit further.

Cheers.
I'm going to try to figure out how to synchronize the static.yoursite.com subdomain with the image folders inside your xenforo installation.

I know Jake knows the answer to this because he does something sort've similar with multiple domains for his own website.
 
Interesting.... I wonder how this would rank on multiple domain names.

For myself, we wanted a true cookie-less domain name... ie... Simply using a sub-domain does not complete the job.

sociallyuncensored.eu is the site, but we use sociallyuncensored.com for cdn reasons (for a true cookie less domain name).
 
Interesting.... I wonder how this would rank on multiple domain names.

For myself, we wanted a true cookie-less domain name... ie... Simply using a sub-domain does not complete the job.

sociallyuncensored.eu is the site, but we use sociallyuncensored.com for cdn reasons (for a true cookie less domain name).
It does the job for my site. I don't think there will be any major difference in speed if the domain was cookie-less. I want a cookie-less domain only to see if it will raise my score on web page test sites.
 
TBH, I don't pay attention to what WebPagetest says, it always shows slow for my forum, but the actual user experience is nice and fast.

webpagetest.webp

Same page ran via Pingdom test

pingdom.webp

I've got my images and js being served from a cookie less domain set up (domain is www.z22se.co.uk, content served from cdn.z22se.com)
 
8thos updated How To Serve Javascript and Static Images from Cloudflare CDN with a new update entry:

Using A Different Domain To Serve Javascript and Static Images From

This guide was originally made regarding a subdomain of your main domain. You can also use another domain to serve files from. If you do so, might as well make it a cookie-less domain and if you activate cloudflare for it, do not do so through your hosts control panel because it only picks up Cloudflare through the www record and not the root domain. If you've already done so, go ahead and deactivate from your cpanel then reactivate your other domain through cloudflare's own site.

Read the rest of this update entry...
 
Top Bottom