CDN set up question

Bombardier

Active member
Ok so I am setting up a CDN with my webhost and one of the things they tell me I need to do is

Your site code will need updated to call these assets via the new
http://cdn.militaryimgaes.net URL (rather than via a relative path for
instance). This then allows the site to fetch those images from the CDN
rather than from the local directories.

Where do I make this change to files within my XF root
 

Bombardier

Active member
So just the config file as described

// CDN support
$config['externalDataUrl'] = 'http://[ZoneURL]/data';
$config['javaScriptUrl'] = 'http://[ZoneURL]/js';

or just the 'Path to Images'
 

Bombardier

Active member
Thank you
Yes it hasn't been set up yet I am asking these questions in advance of that.
So my zone url will be cdn.militaryimages.net? I do also have a sub domain set up as instructed by my web host
 

vanucci

Active member
I struggled with this, so here is what i did.

Similar what teh guys mentioned above, open your config file

22433e1289f105fa1e1649280f8eb6b3.png


edit it

I added the lines for it below my databse details

0d78423948a09cf99b3c7a127ffda9b2.png


Magic.


Then go to appearance, style properties, general, then look for path to images

8317a6d0bc28e07e6372b6457da7add6.png


insert your CDN url

Mine being http://www.gunchester.gunchester.netdna-cdn.com in front of your /styles/themename
 

Bombardier

Active member
Should this work straight away, after setting all that up exactly as described all my images on site disappeared, I waited about 5 mins before reverting

should I add that last line of code (relating to cache) or does that relate to something completely different

Do I need to change the domain mapping of my sub domain to point towards my XF root?
 
Last edited:

Mouth

Well-known member
Should this work straight away, after setting all that up exactly as described all my images on site disappeared, I waited about 5 mins before reverting

should I add that last line of code (relating to cache) or does that relate to something completely different

Do I need to change the domain mapping of my sub domain to point towards my XF root?
Make sure your CDN is working correctly before making any changes in XF!
Eg. If you have mydomain.com/js/custom.js then cdn.mydomain.com/js/custom.js should work too.
 

Bombardier

Active member
Ok I believe my cdn.militaryimages.net is working as it is parsing my site fine.
However when I insert the code to my config all my images disappear
If I revert the config but leave the cdn address in the styles - general settings images are back but I think it lacks the (for want of the accurate termnology) the overlay that dulls down the colours...hope that makes sense.

any ideas
 

Bombardier

Active member
Now I realise how stupid I am I was putting www in my cdn url, now without it it works fine
thanks guys although I expect to find problems further down the line
 

Bombardier

Active member
I have seen some speed improvement but not as much as I thought I would so I contacted my host again!
This is what they said
I am seeing that most images are in the code with what looks to be dynamic query
strings attached to them, which will prevent the CDN service from properly
caching those. That will slow down access to such files.

For instance, instead of calling an image directly like:

91813-932c1eb482a39ef120ea7eb308d1e4aa.jpg

The site in instead using:

91813-932c1eb482a39ef120ea7eb308d1e4aa.jpg?1416330954

Several of the css and js files also have dynamic query strings added to
them as well

Any ideas how to correct this or will I just have to live with?
 

Marcus

Well-known member
You might tell your cdn to not forward query strings for images. Then it always returns tree.png for requests like tree.png?12 or tree.png?9abc

The query string exists most likely for a reason, though.
 

Bombardier

Active member
You might tell your cdn to not forward query strings for images. Then it always returns tree.png for requests like tree.png?12 or tree.png?9abc

The query string exists most likely for a reason, though.
How would we achieve that?
 
Top