I've been reading the past few days on how to do this, tried server-snippets and didn't work (or I did it wrong). Anyway, I would like to have my Ingress for my QA & Prod clusters redirect calls to my public folder in Express.js to my CDN instead of the local folders (/js, /css, /images, etc).
i.e. https://www.example.com/js/all.js -> https://cdn.example.com/assets/js/all.js
Has anyone done this with success and would like to give me some pointers?
This is not how CDNs work. If the traffic reaches your backend it is already "too late" for CDNs. Your static assets must be delivered directly via your CDN. Only non-static page requests, REST-API calls and Websocket connections should make it to your cluster.
What you have to do now is pretty simple. Inside your (generated) HTML, replace the URLs to your assets that point to your own server with the ones pointing to your CDN. E.g. the following:
<script type='text/javascript' src='https://www.example.com/js/all.js'></script>
becomes:
<script type='text/javascript' src='https://cdn.example.com/js/all.js'></script>
In fact, your own server must respond to calls to your assets (e.g. /js, /css, /images, ...) with its own local resources in order to let your CDN fetch and cache the resources properly. Redirecting traffic would probably break your CDNs caching mechanisms.