question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server-side 404 error on route with period in url

See original GitHub issue

Describe the bug

I’m getting 404 error from dev server on this URL:

http://localhost:3000/fuel-savings/test.two

This URL works fine:

http://localhost:3000/fuel-savings/test

Every URL that that I tested that has a period in it causes the 404.

I cloned react-slingshot and ran it almost exactly as is. I had to change react-dom from 16.8.x to 16.9.0 for the install to succeed (corp npm cache doesn’t have 16.8.x), but otherwise zero changes.

There is no output in the node console when I try to load this route.

I originally ran into this problem in my app and then made a clean clone of react-slingshot to test with that and see the same error.

To Reproduce* Steps to reproduce the behavior:

  1. Go to http://localhost:3000/fuel-savings/test
  2. Notice it renders fine, the fule-savings page (the /test is ignored)
  3. Navigate to http://localhost:3000/fuel-savings/test.two
  4. See 404 error

Expected behavior

Page should render same as url without period in it.

Screenshots

Screen Shot 2019-09-04 at 10 04 29 PM

Desktop (please complete the following information):

  • OS: iOS
  • Browser Chrome
  • Version Version 76.0.3809.100 (Official Build) (64-bit)

Thanks!!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
samuelneffcommented, Sep 5, 2019

@kwelch Thank you! It wasn’t quite that simple because once disableDotRule is set, then the bundle.js call gets redirected to root too, so no JS is served. Found fix on another thread:

https://github.com/bripkens/connect-history-api-fallback/issues/40

Which is to also include an accept header filter.

{
  disableDotRule: true,
  htmlAcceptHeaders: ['text/html', 'application/xhtml+xml']
}

Is there any reason this should not be done in react-slingshot by default? I would be happy to submit a PR.

1reaction
nickytonlinecommented, Sep 10, 2019

Thanks for your contribution @samuelneff! 👏

Read more comments on GitHub >

github_iconTop Results From Across the Web

404 error when URL contains a '+' for a parameter with ASP ...
The problem with the dot is that it involves the structure of the domain/subdomain when it is in the direct path. The plus...
Read more >
How To Properly Serve 404 Errors on SPAs (with SEO in Mind)
Out of the box, 404 error pages in SPAs don't work properly, ... one of the first steps is to move the "URL...
Read more >
How to fix 404 error when accessing a specific URL for create ...
The solution is to set some web server configuration to route all requests to /index.html (that's what the SO article you linked to...
Read more >
Error 404 not found - What does it mean & how to fix it! - IONOS
The typical trigger for an error 404 message is when website content has been removed or moved to another URL. There are also...
Read more >
HTTP Status Codes List | HTTP Error Codes Explained
A status code 303 See Other indicates that a server will be redirecting the client/browser to another resource. The resource will be indicated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found