有没有办法获得部署在CDN上的Meteor应用程序生成的静态资产 - 或者像S3这样的静态托管解决方案 - 以提高加载速度和降低托管成本?
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 (eg 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 .
Have a look at Cloudflare Meets Meteor on the meteorhacks blog. If you happen to be a CloudFlare user, it's a pretty easy solution but you'll need to disable WebSockets (or pay a lot, or use a complex workaround).
如果您使用的是陨石,可以使用此软件包: https : //github.com/nate-strauser/meteor-aws-sdk
If deploying through demeteorizer , it is pretty easy to upload the content of the static_cacheable
to a CDN and change the links in app.html
and app.json
.
That process can probably be automated in a custom deploy/capistrano script.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.