Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use CloudFront or any other CDN with meteor application.

I am not getting any good document for using CDN with meteor application. Anyone can guide me to CDN with meteor application ?

Thanks, hare

like image 213
Hare Ram Avatar asked Nov 09 '22 06:11

Hare Ram


1 Answers

I've detailed how we accomplished this at Edthena in this post. The TLDR is:

Add this line somewhere in your server code:

WebAppInternals.setBundledJsCssPrefix(CDN_URL);

Where CDN_URL is your CloudFront URL (e.g. https://a27n0s89ik4xb3.cloudfront.net).

We kept the defaults when creating the CloudFront distribution except for the following:

Origin Domain Name: myapp.example.com
Origin ID: myapp.example.com
Viewer Protocol Policy: HTTPS Only
Compress Objects Automatically: yes

If you serve your own fonts, you can end up with cross origin errors (unless you use a font data URL). Josh Owens describes how to deal with that in his post.

like image 186
David Weldon Avatar answered Nov 15 '22 07:11

David Weldon