Skip to content

feat: return 404 status code when 404.html - #74

Merged
oycyc merged 1 commit into
masterfrom
feat/404
Aug 15, 2025
Merged

feat: return 404 status code when 404.html#74
oycyc merged 1 commit into
masterfrom
feat/404

Conversation

@oycyc

@oycyc oycyc commented Aug 15, 2025

Copy link
Copy Markdown
Member

I saw this!

image

For all the pages that are actually redirected to 404.html, it does indeed already return 404.
But if someone explicitly went to 404, it doesn't return 404.
Add this in. Why not.

image

Summary by CodeRabbit

  • Bug Fixes
    • Direct visits to /404 now correctly render the 404 page.
    • Unknown routes reliably show the 404 page without misrouting.
    • Ensures proper 404 status codes for both direct and catch-all paths, improving client and crawler behavior.
    • Reduces chances of intermittent 404 display issues in edge cases.

@oycyc
oycyc requested a review from a team as a code owner August 15, 2025 19:28
@netlify

netlify Bot commented Aug 15, 2025

Copy link
Copy Markdown

Deploy Preview for masterpoint ready!

Name Link
🔨 Latest commit 79fd570
🔍 Latest deploy log https://app.netlify.com/projects/masterpoint/deploys/689f8a64433eaa0008ee3195
😎 Deploy Preview https://deploy-preview-74--masterpoint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 24
Accessibility: 89
Best Practices: 92
SEO: 79
PWA: 70
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds an explicit redirect from "/404" to "/404.html" with status 404 in netlify.toml, placed before the existing catch-all redirect "/*" to "/404.html" (status 404). No other changes.

Changes

Cohort / File(s) Summary
Netlify redirects
netlify.toml
Inserted explicit redirect: "/404" → "/404.html" (status 404), positioned before existing "/*" → "/404.html" (status 404). No other sections modified.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • gberenice

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/404

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
netlify.toml (1)

41-45: Also handle the trailing slash variant /404/ (optional but recommended)

If /404/ exists (common with static site generators), it’ll behave like /404 and may also need to be forced to return 404.

Please confirm whether /404/ resolves to a page in the deployed site. If yes, add the following block right after the /404 rule:

 [[redirects]]
 from = "/404"
 to = "/404.html"
 status = 404
 force = true

+[[redirects]]
+from = "/404/"
+to = "/404.html"
+status = 404
+force = true
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 54e9e59 and 79fd570.

📒 Files selected for processing (1)
  • netlify.toml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
netlify.toml

📄 CodeRabbit Inference Engine (CLAUDE.md)

Add redirects to netlify.toml (e.g., /updates/* → /blog/*)

Files:

  • netlify.toml
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: masterpointio/masterpoint.io#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-31T21:30:32.227Z
Learning: Applies to netlify.toml : Add redirects to netlify.toml (e.g., /updates/* → /blog/*)
Learnt from: CR
PR: masterpointio/masterpoint.io#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-31T21:30:32.227Z
Learning: Build settings, redirects, and Hugo version are managed in netlify.toml
📚 Learning: 2025-07-31T21:30:32.227Z
Learnt from: CR
PR: masterpointio/masterpoint.io#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-31T21:30:32.227Z
Learning: Applies to netlify.toml : Add redirects to netlify.toml (e.g., /updates/* → /blog/*)

Applied to files:

  • netlify.toml
📚 Learning: 2025-07-31T21:30:32.227Z
Learnt from: CR
PR: masterpointio/masterpoint.io#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-31T21:30:32.227Z
Learning: Build settings, redirects, and Hugo version are managed in netlify.toml

Applied to files:

  • netlify.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - masterpoint
  • GitHub Check: Header rules - masterpoint
  • GitHub Check: Pages changed - masterpoint

Comment thread netlify.toml
Comment on lines +41 to +45
[[redirects]]
from = "/404"
to = "/404.html"
status = 404

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add force = true to ensure this rule overrides the existing /404 file

If Hugo outputs /404/index.html, Netlify will serve that file with 200 unless the redirect is forced. Without force = true, this rule may not apply, and the status will remain 200, defeating the PR’s objective.

Apply this diff:

 [[redirects]]
 from = "/404"
 to = "/404.html"
 status = 404
+force = true
🤖 Prompt for AI Agents
In netlify.toml around lines 41 to 45, the redirect from "/404" to "/404.html"
lacks force = true so it may not override an existing /404 file (e.g., Hugo's
/404/index.html) and Netlify could serve it with 200; update the redirect entry
to include force = true so Netlify will apply the 404 status unconditionally for
requests to /404.

@oycyc
oycyc enabled auto-merge (squash) August 15, 2025 19:32

@Gowiem Gowiem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Haha way to be on it @oycyc 👍

@oycyc
oycyc merged commit df78307 into master Aug 15, 2025
8 checks passed
@oycyc
oycyc deleted the feat/404 branch August 15, 2025 19:57
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.

2 participants