Redirect unknown pages home with a 301 - #32
Merged
Merged
Conversation
A mistyped URL or a delisted server used to render a 404. Both now resolve to the home page with a permanent redirect, so a visitor who follows a stale link lands somewhere useful instead of a dead end. - Add a catch-all GET route that 301s any unmatched browser path to the home page - Check the listing exists in a plug, ahead of the LiveView, because a LiveView redirecting from mount answers with a 302 and this had to be a 301 - Select a constant for that check rather than loading the row, whose article and tool columns are large - Keep the JSON API answering 404, since a client following a redirect into HTML gets a parse error instead of a clear miss - Leave POST alone: a stray POST is not a mistyped URL, and redirecting it would silently drop the body Verified against the running app: unknown paths and missing listings return 301 to /, while real listings, the catalogue and the API are untouched. --- Pages affected: - [MCP Registry](https://ai.mcpharbor.dev/) — where every unmatched URL now lands. - [Browse MCP servers](https://ai.mcpharbor.dev/servers) — the searchable catalogue, still served directly. - [Brave Search MCP](https://ai.mcpharbor.dev/servers/com.brave/brave-search) — an existing listing, unaffected by the redirect. - [Submit a server](https://ai.mcpharbor.dev/submit) — publish your own MCP server listing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #31.
A mistyped URL or a delisted server used to render a 404. Both now resolve to the home page with a permanent redirect.
GETroute 301s any unmatched browser path to the home pagemount/3answers the initial request with a 302 and this had to be a 301article_contentandtoolscolumns are largePOSTis deliberately untouched: a stray POST is not a mistyped URL, and redirecting it would silently drop the bodyVerified against the running app:
/servers/io.github.nobody/nothing//totally-made-up//a/deep/missing/path//servers/com.brave/brave-search/servers,//api/v0/nope71 tests pass.
One caveat worth recording: search engines treat a blanket redirect of every missing URL to the home page as a soft 404, so these URLs are unlikely to pass link value, and Google may report them as such in Search Console. A targeted redirect per retired URL preserves more. Flagging it as a known tradeoff, not a blocker.
Pages affected:
🤖 Generated with Claude Code