App Router: Incorrect 200 status for non-existent pages with Parallel Routes on client-side
Unanswered
Tomistoma posted this in #help-forum
TomistomaOP
Hi,
I'm encountering an issue with 404 handling in my Next.js (App Router) project that uses Parallel Routes.
Problem Description:
When I navigate to a non-existent page (e.g., /settings) from a client-side component (like a sidebar link), the browser's network tab shows GET request for that path, returning a 200 OK status. The actual not-found.tsx component for that route segment is not rendered immediately.
However, if I then perform a hard refresh of the browser on that same non-existent URL (e.g., localhost:3000/settings), the server correctly returns a 404 Not Found status, and my custom 404 page (not-found.tsx) is displayed as expected.
Setup:
Next.js (v15.3.2 using App Router)
Parallel Route: I have a parallel route named @breadcrumbs within an (app) route group.
layout.tsx defines the main children slot and the @breadcrumbs slot.
not-found.tsx exists and is intended to handle 404s for the (app) segment.
default.tsx exists and returns #Unknown Channel</>.
Paralell Routes was built based on this guide: https://jeremykreutzbender.com/blog/app-router-dynamic-breadcrumbs
Question:
What could be causing Next.js to initially return 200 OK for non-existent pages during client-side navigation when Parallel Routes are involved? How can I ensure that the 404 handling is immediate and correct, consistent with a hard refresh?
Any insights or suggestions would be greatly appreciated.
Thanks!
I'm encountering an issue with 404 handling in my Next.js (App Router) project that uses Parallel Routes.
Problem Description:
When I navigate to a non-existent page (e.g., /settings) from a client-side component (like a sidebar link), the browser's network tab shows GET request for that path, returning a 200 OK status. The actual not-found.tsx component for that route segment is not rendered immediately.
However, if I then perform a hard refresh of the browser on that same non-existent URL (e.g., localhost:3000/settings), the server correctly returns a 404 Not Found status, and my custom 404 page (not-found.tsx) is displayed as expected.
Setup:
Next.js (v15.3.2 using App Router)
Parallel Route: I have a parallel route named @breadcrumbs within an (app) route group.
layout.tsx defines the main children slot and the @breadcrumbs slot.
not-found.tsx exists and is intended to handle 404s for the (app) segment.
default.tsx exists and returns #Unknown Channel</>.
Paralell Routes was built based on this guide: https://jeremykreutzbender.com/blog/app-router-dynamic-breadcrumbs
Question:
What could be causing Next.js to initially return 200 OK for non-existent pages during client-side navigation when Parallel Routes are involved? How can I ensure that the 404 handling is immediate and correct, consistent with a hard refresh?
Any insights or suggestions would be greatly appreciated.
Thanks!