rsnext/errors/max-custom-routes-reached.mdx
Delba de Oliveira 44d1a1cb15
docs: Migrate error messages to MDX and App Router. (#52038)
This PR is part of a larger effort to migrate error messages to MDX and
use App Router: https://github.com/vercel/front/pull/23459
2023-07-05 06:11:16 -07:00

19 lines
892 B
Text

---
title: Max Custom Routes Reached
---
## Why This Error Occurred
The number of combined routes from `headers`, `redirects`, and `rewrites` exceeds 1000. This can impact performance because each request will iterate over all routes to check for a match in the worst case.
## Possible Ways to Fix It
- Leverage dynamic routes inside of the `pages` folder to reduce the number of rewrites needed
- Combine headers routes into dynamic matches e.g. `/first-header-route` `/second-header-route` -> `/(first-header-route$|second-header-route$)`
## Useful Links
- [Dynamic Routes documentation](/docs/pages/building-your-application/routing/dynamic-routes)
- [Rewrites documentation](/docs/pages/api-reference/next-config-js/rewrites)
- [Redirects documentation](/docs/pages/api-reference/next-config-js/redirects)
- [Headers documentation](/docs/pages/api-reference/next-config-js/headers)