Service worker returning index page for nonexistent route
See original GitHub issueIs this a bug report?
Not sure. Trying to determine that.
Which terms did you search for in User Guide?
service worker
Environment
Node v6.9.2 NPM v3.10.9 react-scripts 1.0.14
Mac OSX El Capitan 10.11.6 Google Chrome Version 61.0.3163.100 (Official Build) (64-bit)
Steps to Reproduce
- Scaffold a new react application following the instructions found on the user guide.
- Serve index.html and all related artifacts in the
./build
directory from my server. - Navigate to
localhost:8080
. Observe that the “Welcome to React” page is displayed. - Navigate to
localhost:8080/idonotexist
. Observe that the “Welcome to React” page is still displayed.
Expected Behavior
I expected the localhost:8080/idonotexist
request to be handled by the server, rather than the service worker.
Actual Behavior
The service worker returns localhost:8080/idonotexist
from the service worker. The page that is displayed is the default “Welcome to React” page.
Is this the desired behavior of the service worker? My understanding of service workers is limited, so I’m trying to determine if this is a bug or simply a gap in my knowledge.
Thanks for the great tool. Keep up the good work.
Brandon
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Service worker returning Offline page instead of 404 page ...
I'm using this service worker for caching and offline mode. when I am already on any existing page of my website and I...
Read more >Comparing Wayne.js with Express.js for service worker routing
In this article, we will describe how to export a simple REST API from Express.js to Wayne.js for service worker routing.
Read more >workbox-routing - Chrome Developers
Routes requests in your service worker to specific caching strategies or callback functions.
Read more >Customizing Service Workers in ReactJS Progressive Web ...
Learn how to customize Google Workbox's default behavior for a service worker in your React app. This articles explains how to modify the ......
Read more >Using Angular routes in a single-page application
It is possible for a user to try to access a route that you have not defined. To account for this behavior, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If anyone is looking for a non-eject solution to this until #3419 is merged, you can use react-app-rewired with this config-overrides.js.
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.