My Heroku backed app is now serving a certain JS file, but due to high rpms I would like to serve it from my CDN.

Is it possible to make a redirect from myapp.herokuapp.com/file.js to mycdn.com/bucket/file.js without makeing the redirect inside my app? My app is a NodeJs/Express app.



Redirecting is sub-optimal, as Heroku still has to handle the initial requests. Much of the load would remain and the site would still crash or require high resources under heavy load.

You're much better off finding where your app generates myapp.herokuapp.com/file.js and having it output mycdn.com/bucket/file.js so the request is never handled by the Heroku servers. We typically use a function to generate CDN URLs so a change in CDN requires only a configuration tweak.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.