react-static: [Bug] Path with dot doesn't work

Reporting a bug?

Routes that contain a dot give the error Cannot GET [path]. I’m upgrading from a much older version of react-static and this used to work.

Environment

$ npx envinfo --system --npmPackages react* --binaries --npmGlobalPackages react* --browsers
npx: installed 1 in 2.21s

  System:
    OS: Windows 10 10.0.18362
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 3.08 GB / 15.90 GB
  Binaries:
    Node: 10.16.3 - C:\Program Files\nodejs\node.EXE
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
    Internet Explorer: 11.0.18362.1
  npmPackages:
    react: ^16.9.0 => 16.12.0
    react-dom: ^16.9.0 => 16.12.0
    react-router: ^5.1.2 => 5.1.2
    react-router-dom: ^5.1.2 => 5.1.2
    react-static: ^7.2.0 => 7.2.3
    react-static-plugin-react-router: ^7.2.3 => 7.2.3
    react-static-plugin-sass: ^7.2.2 => 7.2.2
    react-static-plugin-sitemap: ^7.2.0 => 7.2.3
    react-static-plugin-source-filesystem: ^7.2.0 => 7.2.3

Steps to Reproduce the problem

  1. Create a basic template.
  2. Create a route such as
{
    path: "foo.bar",
    template: "src/pages/foobar"
}
  1. Run the site and try to go to the URL /foo.bar.

Expected Behavior

Dots in the URL should not cause an error.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Thanks for the info. Yes my site works when those lines are removed.

I’m using react-static for a documentation site. The URL paths I use have dots in them, and it really needs to stay like this. For example https://joshclose.github.io/CsvHelper/api/CsvHelper.Configuration.Attributes/ I would like a person to be able to type an API into the URL and it to come up.

This is currently running on an older version of react-static and I’m upgrading it. How did it used to work?

I found that the issue is coming from webpack dev server. If I add this config, it goes away.

devServer: {
	historyApiFallback: {
		disableDotRule: true
	}
}

I’m now getting this error.

404 - Oh no's! We couldn't find that page :(