React Router "hijacking" path of static files

Viewed 1240

Let's say I have the following setup:

  1. React Application at /
  2. A previously existing application at /path/to/application
  3. A JPG at /assets/image.jpg
  4. A static HTML file for use in an iFrame at /static/index.html

ReactRouter (react-router-dom) is attempting to resolve all of these scenarios - displaying the Not Found component in example 2, 3 and 4 as they are naturally not configured.

Strangely, this behaviour seems to differ per browser. Safari and Firefox Quantum resolve as expected, but Chrome does not. For example, in the iFrame example, Chrome is displaying a new instance of the entire root React app inside the iFrame, whereas Safari and Firefox are loading the static HTML file contents.

I have tried using HashRouter instead of BrowserRouter but with no luck.

Is there a way I can configure my React application to ignore specific child paths, to allow the server a chance to handle this content?

0 Answers
Related