How to Deploy a React Router App to Heroku

JBallin
1 min readNov 6, 2018

--

UPDATE: create-react-app-buildpack now has routing built in by default!

Unless you want further customization, the buildpack will automatically use the configuration below (meaning you don’t need to do anything)!

The (outdated) post is maintained below, for posterity.

Just add a static.json file!

$ cd MY-APP
$ echo '{
"root": "build/",
"routes": {
"/**": "index.html"
}
}' > static.json

This tells the create-react-app buildpack to send ALL requests to index.html, otherwise you’ll get 404’s when trying to hit your routes (i.e. /signup).

--

--