WebAppInternals.setBundledJsCssPrefix to use CloudFront as a CDN for static JS and CSS assets. I have a CloudFront distribution with a custom origin that points to my Meteor app. The problem is that when I hit a CloudFront URL, I just get redirected back to my app server, rather than CloudFront serving the JS/CSS directly. It appears that CloudFront is getting a 302 redirect back from my app and caching that, rather than caching the actual file.
From what I’ve read, it seems that the usual causes for this are (1) redirecting e.g. www back to a bare URL (which I don’t have), or (2) redirecting http to https. I do the latter using the
force-ssl package, but if indeed a user hits my app with http instead of https then the URLs that they hit CloudFront with should already have been rewritten to use https by the time they get them (since they’re embedded in the HTML page served by Meteor). So it’s not clear to me how CloudFront would be getting a 302 from my app. Has anyone had any success using CloudFront with a custom origin as a CDN?