Don't Host Static Sites on Heroku
Heroku is a fantastic platform. No, seriously. At Divshot we have 20 Heroku applications running and I personally have at least 30 more. It's my favorite hosting platform in the world for Ruby and Node.js. But if you're hosting static sites on Heroku, you're doing it wrong.
It's tempting. They even have docs that tell you how. It's just so easy to spin up a new Heroku app. You use it for everything else, so why not for this?
- It's Expensive. To keep your site up and running full-time, you're going to have to pay for a second dyno. That'll run you at least $37 a month. Just to host static files.
- Static Sites Don't Need App Servers. The blog posts you'll read tell you how to use Rack or Node.js to serve up your static content on Heroku. That's like hiring Elon Musk to deliver coffee to your office. Except worse, because it turns out Elon Musk is much better at inventing the future so he's slow and gets some of the orders wrong.
- Geostationary. Heroku has two regions: US and Europe, and your app only lives in one. Static content is made to be distributed on a global CDN so that your users get their content as close to instant as possible.
Yes, I have a vested interest in telling you this, Divshot is a static web hosting service. Yes, we have a CLI that works much like Heroku's and gives you free subdomain hosting. And yes, all you have to do to get started is type:
npm install -g divshot-cli && divshot login
Bring on the cries of bias, tell me I'm a hollow shill. Just please, when deploying static content, use something suited to the task. Use Amazon S3 (preferably with a CDN), use GitHub Pages, use nginx. Use Divshot. Just don't run an entire Ruby/Node.js application server for static content. Every time you do, a kitten cries.
You don't want to make the kitten cry, do you?