JulienD JulienD - 2 months ago 23
React JSX Question

React-router "Cannot GET /*" except for root url

I am willing to use React-router for my application, and I am trying the example given in the doc first, which I copied below. Now when I go to

, I see "App" as expected, but every other page, such as
returns "Cannot GET /inbox". What am I missing here ?

var About = React.createClass({
render: function () {
return <h2>About</h2>;

var Inbox = React.createClass({
render: function () {
return <h2>Inbox</h2>;

var App = React.createClass({
render () {
return (

var routes = (
<Route path='/' handler={App}>
<Route path="about" handler={About}/>
<Route path="inbox" handler={Inbox}/>


I believe the issue is that you are making a http resource request:

GET /inbox HTTP/1.1
Host: localhost:3000

but are using client-side only routing. Are you intending on doing server side rendering too? You might need to change your router location to be HistoryLocation instead of HashLocation (the default).

The location prop of Router.run tells it where to match the routes against. If you're not running server side React, I believe you have to use Router.HashLocation (or just leave it blank).

If not, you are accessing your component the wrong way. Try using http://localhost:3000/#/inbox. It can take a little to familiarize yourself with React-Router but it is definitely worth it!

React Router Documentation - HashLocation