Skip to content

feat: pages not present at build throw 404 #1726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tris-signoz
Copy link
Contributor

@tris-signoz tris-signoz commented Jul 22, 2025

📄 PR Summary

When a non-existent page is accessed, the UI correctly renders a "404 - Page Not Found" screen. However, the server responds with a 200 OK status instead of 404 Not Found.
The changes made in the PR solve for this behaviour for the given routes:

  1. /docs/*
  2. /faqs/*
  3. /blog/*
  4. /case-study
  5. /comparisons/*
  6. /guides/*
  7. /newsroom/*
  8. /tags/*

Since these pages are also present in sitemap, it is important that they follow SEO guidelines.

✅ Summary of Changes

  1. Declaring "all params are known at build-time" (export const dynamicParams = false and export const dynamic = 'error' added to page.tsx files for dynamic routes)
    Ref -
    https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicparams
    https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic

  2. Components which use useSearchParams() wrapped in a suspense boundary (to avoid CSR bailouts) with a static fallback (to ensure SEO compliance)
    Ref -
    https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
    https://nextjs.org/docs/app/getting-started/partial-prerendering#dynamic-rendering

  3. Made GrowthBookProvider a client component (uses cookies())

Other refs -

  1. https://nextjs.org/docs/app/api-reference/file-conventions/not-found#not-foundjs

🧪 How to Test

Visit any page on the routes above

  1. Happy case - The page is present > Open devtools > Look at the Doc fetched > See if the page content is server-side rendered
  2. Pages that should throw a 404 - Visit a route that does not exist (Eg: /docs/does-not-exist) > Open devtools > Look at the Doc fetched > See that the call has status code 404

🔍 Related Issues

Solves https://github.com/SigNoz/engineering-pod/issues/2689

📸 Screenshots / Screen Recording (if applicable / mandatory for UI related changes)

Before:
https://github.com/user-attachments/assets/9b15dfb4-f2cc-42cf-9a09-ff6987c19285

After:
https://github.com/user-attachments/assets/3754465e-c9c2-4e17-af88-155aaa9552a5

Copy link

vercel bot commented Jul 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
signoz-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 5:20am

@tris-signoz tris-signoz changed the title Draft: feat: pages not present at build throw 404 feat: pages not present at build throw 404 Jul 25, 2025
@yuvraajsj18
Copy link
Member

The issue reported in https://github.com/SigNoz/engineering-pod/issues/2689 is resolved by this.

CleanShot 2025-07-25 at 11 15 17@2x CleanShot 2025-07-25 at 11 15 02@2x CleanShot 2025-07-25 at 11 17 53@2x

@tris-signoz tris-signoz requested a review from a team July 25, 2025 06:27
if (child.props.value === activeTab)
return <div key={child.props.value}>{child.props.children}</div>
if ((child.props as any).value === selectedTab)
return <div key={(child.props as any).value}>{(child.props as any).children}</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use correct types, avoid using any


export default function TopNavStaticContent() {
return (
<div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use React Fragment

Copy link
Member

@YounixM YounixM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor UI comments, feel free to pick them up in the next PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants