Closed bebraw closed 10 years ago
Thank you for posting - this looks very useful for constructing an endpoint on top of a CDN.
I previously did some work on constructing a jspm endpoint on top of cdnJS.
My conclusion though was that we really want everything (github:
, npm:
, etc) all over a single CDN system / connection, so there is only a single point of failure. Additionally without SPDY push support, the major benefit of using these endpoints in production is lost.
Unfortunately at that moment that leaves jspm.io to become its own CDN, until Nginx can support SPDY push.
Happy to discuss further, but this is the best analysis that I can come up with.
jsDelivr can do proxy caching if needed. For example: cdn.jsdelivr.net/jspm/ -> jspm.com/files/
Would that solve the first problem?
Potentially... does this handle cache expiry and ETags? We also have some custom headers as well. Apart from gathering statistics, the server is mostly stateless.
My current plan is simply to start scaling out the server on a GeoDNS with redundancy. Would be a fun ops project :)
I can configure the proxy to pass all headers. This way you will control cache-expiry and anything else. Its up to you :)
The only issue with this is that the cache headers need to be handled intelligently by the CDN to ensure adequate revalidation. So if an ETag matches, sending 304 etc. And also then having some control over the CDN cache expiry itself.
In jspm this is all finely tuned to ensure that npm repos are fresh where expected, and cached with far future expires when stable versions are provided.
The argument is that for a system like this, the CDN needs to have a certain level of smarts. And unfortunately, until CDNs provide enough simple hooks into that functionality, it means rewriting this low-level handling is still the best approach.
I think this stuff will converge in time, but right now that puts us in different positions unfortunately.
Well, as you see fit. Just so you know I would be happy to help. So feel free to ping me if you need anything.
Sure, and thanks for reaching out. To summarise the features that would need to be supported for this approach to work:
X-Associated-Content
header.Perhaps (2) and (3) are already supported today in some form? If the status on the above changes definitely let me know.
Also if you're interested in getting involved in jspm in other ways definitely let me know - always happy to chat.
Hi,
Just thought to point out there's a little API available for some of the most popular JavaScript CDNs at https://github.com/jsdelivr/api . Maybe you can use that somehow (ie. load assets from CDN or something).