React-router: Routing fails if query parameter contains a dot

Created on 19 Jun 2015  路  2Comments  路  Source: ReactTraining/react-router

Configuration:

<Route name="app" path='/' handler={App}>
  // ...
  <Route name="deploy" handler={DeployPage}/>
  // ...
</Route>

If http://localhost:3000/deploy?url=github.com is called directly, routing fails:

Cannot GET /deploy?url=github.com

while http://localhost:3000/deploy?url=github%2Ecom works.

Most helpful comment

I had the same issue proved to be webpack dev server with history-api-fallback enabled failed to pass these urls to the react app. Hacked webpack config to pass these to react with:

...
devServer: {
  proxy: {
    '/*.*': { // Match all URL's with period/dot
      target: 'http://localhost:8080/',  // send to webpack dev server
      rewrite: function(req){
        req.url='index.html';  // Send to react app
      }
    }
  }
}
...

All 2 comments

I double checked it and it works fine:

screen shot 2015-09-09 at 15 03 56

I had the same issue proved to be webpack dev server with history-api-fallback enabled failed to pass these urls to the react app. Hacked webpack config to pass these to react with:

...
devServer: {
  proxy: {
    '/*.*': { // Match all URL's with period/dot
      target: 'http://localhost:8080/',  // send to webpack dev server
      rewrite: function(req){
        req.url='index.html';  // Send to react app
      }
    }
  }
}
...
Was this page helpful?
0 / 5 - 0 ratings