I want to see if I can create a stack based on both, CDN and also angular 2 universal. So when the user navigate has the CDN to get the assets, and if the user access the first time will have the complete html rendered by Universal.
I was thinking in:
Client <===> Akamai <===> Varnish <===> Origin Server (node.js with universal)
This sounds good? have you ever tried it? Also i'm considering adding nginx and ELB for the complete stack.
The question is: - Can this stack work as expected?
Yes it can be done! The big issue is how do you invalidate an arbitrary number of http requests made in Angular that determine the rendered page. Using some sort of header schema to invalidate might be helpful.
Assuming your are using official ng-express engine, a service like this could let you define the response from the Angular runtime: