New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.7] Any client should be able to request any <hash>.{js,css,...} asset #9953
Comments
It surprises me that a CDN would not forward the end-user client UA when reading through from the origin? A CDN needs to be able to serve both modern and legacy assets, so forcing a single UA of its own choosing seems unacceptable… |
The purpose of the CDN is to minimize interaction with the original server. But the CDN can’t decide between modern and legacy itself. So, either the CDN needs to cache a different file per each UA, or the content must be independent of the UA. |
That's why we set the |
Possibly helpful? Configuring CloudFront to Cache Objects Based on Request Headers If that works, it's definitely something we should add to the 1.7 migration guide. |
Mhh, even if it works, it would mean caching 1000s of files vs 2 on CloudFront. |
Ok, I see what you mean. This could be an good opportunity to put Lambda functions in front of CloudFront, to categorize user agents as modern or legacy before requesting resources from the CDN, but that's beginning to sound pretty complicated. By the way, during the 1.7 beta process, we did try prefixing static asset URLs like you mentioned, but it ended up causing too many problems for resolving relative URLs, especially in CSS files (see #9849). I agree making all |
What’s the difference between modern and legacy assets? It looks like, they’re the same, except the boilerplate pointing to different JS assets, right? |
Sorry, I'm using the word "asset" in a loose generic sense here: any static resource served via HTTP, including JS, CSS, images, etc. Anything a CDN could host. In Meteor, there's also a notion of assets added with |
For the record, I found a reasonable workaround:
|
As long as that doesn't put too much load on your servers, it definitely works! |
Wow, thanks for fixing this issue so fast, @benjamn! |
Currently, Meteor returns different content based on the User-Agent. This breaks the setup with a CDN such as CloudFront (which uses "Amazon CloudFront" as UA).
Since the JS files are named by their hash, everything should fine. However, Meteor returns a 404 if you access the "modern" JS bundle using a "legacy" UA!
The easiest fix would be to include the modern JS files also in the legacy bundle.
Another option could be to use different public addresses for each bundle (e. g.
/web.browser/5c8f3031f7e146f0a3d07cadb12848c04bb176b5.js?meteor_js_resource=true
).The text was updated successfully, but these errors were encountered: