Fixing React Router 7 (or remix) Edge 404s on Netlify

1/28/20262 min read

Fixing React Router 7 Edge 404s on Netlify


If you deploy a React Router 7 app to Netlify Edge Functions, you may run intoan annoying production-only error:


No routes matched location "/test/route"


It only happens on client-side navigation, not when you visit the URLdirectly. Dev works fine. Production breaks. Sound familiar?


Below is the short version of what actually fixed it for us.

The Symptoms

  • Internal navigation to nested routes (two or more `/` segments) throws`No routes matched location`.
  • Directly visiting the same URL works.
  • Netlify Edge logs show successful `__manifest` requests, but the response does not include all routes (for example, `/test/route`).


This points to a route manifest discovery problem, not a routing problem.

The Root Cause (for us)


React Router’s lazy route discovery is enabled by default. That means the client receives a partial manifest and discovers more routes by fetching /__manifest on demand. If that request is incomplete (or cached incorrectly) the client simply does not know about some routes, even though the server does.


Result: the client says “No routes matched location” even though the server could render it.


The Fix


Disable lazy route discovery so all routes are included in the initial manifest. This avoids flaky or incomplete edge manifest responses.

In `react-router.config.ts`:


```tsimporttype { Config } from"@react-router/dev/config";
exportdefault {ssr: true,future: {v8_splitRouteModules: false, },routeDiscovery: {mode:"initial", },} satisfiesConfig;```

That single change fixed the client-side navigation 404s in production.

Optional Reinforcements


We also added explicit edge function routing for data/manifest requests to makesure they always hit the React Router edge handler:


```toml[[edge_functions]]path = "/__data"function = "react-router"
[[edge_functions]]path = "/__data/*"function = "react-router"
[[edge_functions]]path = "/__manifest"function = "react-router"
[[edge_functions]]path = "/__manifest/*"function = "react-router"```


Why This Works


By switching `routeDiscovery` to `initial`, the client no longer depends onruntime `__manifest` fetches to discover routes. Every route is already knownafter the first load, so client-side navigation can never fail due to missingroutes.


Final Notes


If you are seeing this only in production, and only on internal navigation,don’t waste time on redirects or SPA fallbacks. Check your React Routermanifest behavior first.


This fix is simple, safe, and easy to reverse if you want lazy discovery backlater.

Related guides

Shopify
Your Shopify store’s SEO titles (also known as title tags) play a crucial role in how your products, collections, and pages appear in Google search results. A strong title not only helps you rank but also convinces searchers to click. In 2025, search intent, AI-driven snippets, and mobile-first browsing make it more important than ever to optimise your SEO titles strategically. This guide walks you through how to create effective Shopify SEO titles that drive traffic and sales.
Shopify
How to move inventory between Shopify locations. This guide trims it to the essentials: create the transfer, reserve stock, ship, mark in transit, and receive—so your team can keep shelves full and orders flowing.
Shopify
Learn how to create SEO-friendly titles and meta descriptions in Shopify that improve your Google rankings and drive more clicks to your store.

Certifications

Hotjar PartnerMailchimp Foundations