alt=
DannyA
@dannya
10 years ago
584 posts
Is there an easy way to configure jamroom for a cdn? Usually static objects are re-written to a special host name, e.g. cdn.mysite.com, and all objects requested through that host name are cached and delivered by the CDN. Jamroom generates the url of objects dynamically. How can I redirect static objects through a different host?
updated by @dannya: 12/29/14 09:14:08AM
brian
@brian
10 years ago
10,148 posts
andersda:
Is there an easy way to configure jamroom for a cdn? Usually static objects are re-written to a special host name, e.g. cdn.mysite.com, and all objects requested through that host name are cached and delivered by the CDN. Jamroom generates the url of objects dynamically. How can I redirect static objects through a different host?

You don't want to do redirection to a CDN (that defeats the purpose). What you do is:

- upload the static elements you want to put on a CDN to your CDN
- update your templates to reference those elements from the CDN instead of locally.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
alt=
DannyA
@dannya
10 years ago
584 posts
Slightly incorrect; but my fault for improperly wording the question.

You don't re-direct to the cdn. You DIRECT to the cdn. However, you don't upload your assests to the cdn. The cdn does a reverse proxy to your server to grab the asset if it's not in their cache.

So, basically I want to be able to have all static assets (images, listen audio, tpl files, etc) come from the cdn. In order to do that, you have to have all the pages that reference those objects request them from a different host. So you need to re-write links to all jpg files to http://cdn.mysite.com/images/filename.jpg instead of http://www.mysite.com/images/filename.jpg.

The ideal would be a CP setting to define the base URL of all static file types.
brian
@brian
10 years ago
10,148 posts
andersda:
Slightly incorrect; but my fault for improperly wording the question.

You don't re-direct to the cdn. You DIRECT to the cdn. However, you don't upload your assests to the cdn. The cdn does a reverse proxy to your server to grab the asset if it's not in their cache.

Got it - I'm used to using AWS's CloudFront, where you push your images to an S3 bucket, and in turn they get pushed out to the edge servers.

Quote:
So, basically I want to be able to have all static assets (images, listen audio, tpl files, etc) come from the cdn. In order to do that, you have to have all the pages that reference those objects request them from a different host. So you need to re-write links to all jpg files to http://cdn.mysite.com/images/filename.jpg instead of http://www.mysite.com/images/filename.jpg.

The ideal would be a CP setting to define the base URL of all static file types.

Since 99% of users would never use this, having those options baked into all the templates is overkill - so you would just want to update your templates to reference your CDN URL instead of $jamroom_url.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
alt=
DannyA
@dannya
10 years ago
584 posts
Yes, you would push to storage (s3) but cloudfront pulls from s3 if there's a cache miss.

So, wouldn't I have to re-write some of the core templates to make this happen? What happens to those edits when I try to update the core templates with a new JR release?
michael
@michael
10 years ago
7,719 posts
You would clone whatever skin you wanted to use, then update the links you wanted updating.

Because you cloned the skin you can make any changes you want to without the skin being effected by updates because its a different skin.

If you want to know whats different, compare the templates before/after. All the updates are put in their own directory and left on the server when an update comes in.

The alternative is to use the template editor in the ACP to edit the templates without creating a new skin. (I wouldn't do it this way as its pretty large scale, clone the skin is better). This way you could use the built in template compare what changed.
nate
@nate
10 years ago
917 posts
Any core (module) template can be overridden by a skin template.

Your skin is already custom, so no need to clone anything.

Tags