0

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.

Thanks!

maephisto
  • 131
  • 4

1 Answers1

0

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.

ceejayoz
  • 32,469
  • 7
  • 81
  • 105