Skip to content

Add landing page for non-MoQ clients accessing relay#1280

Open
kixelated wants to merge 1 commit intomainfrom
claude/add-moq-relay-dummy-page-1yYQ6
Open

Add landing page for non-MoQ clients accessing relay#1280
kixelated wants to merge 1 commit intomainfrom
claude/add-moq-relay-dummy-page-1yYQ6

Conversation

@kixelated
Copy link
Copy Markdown
Collaborator

Summary

This PR adds a user-friendly landing page that is served when a regular web browser or non-MoQ client accesses the relay directly, replacing generic error responses with informative guidance.

Key Changes

  • New landing page: Added landing.html with styled informational content explaining that the relay is a MoQ service and directing users to https://moq.dev for more information
  • Web server fallback: Configured the Axum router with a fallback handler (serve_landing) that catches all unmatched routes and serves the landing page with a 404 status code
  • WebSocket error handling: Updated serve_ws to gracefully handle extraction failures (WebSocket upgrade, path, and query rejections) by serving the landing page instead of exposing internal error messages
  • Response helper: Added landing_response() utility function to generate consistent landing page responses

Implementation Details

  • The landing page includes responsive design with dark mode support and links to the MoQ specification
  • The fallback handler is registered at the router level to catch any requests that don't match defined routes
  • WebSocket handler now accepts Result types for its extractors, allowing it to detect when a plain HTTP request arrives and serve the landing page instead of letting Axum's WebSocket extractor reject the request with a technical error message
  • The landing page HTML is embedded at compile time using include_str!() for efficient serving

https://claude.ai/code/session_01FMvy3oWhasZwmxnCcch8tN

Visiting a relay directly in a browser previously returned
"Request method must be `CONNECT`" from axum's WebSocketUpgrade
extractor, which is confusing for anyone who stumbles onto a
relay URL. Add an HTML landing page that explains the server
is a moq-relay instance and points at https://moq.dev.

The page is served as the axum router fallback (e.g. for GET /)
and also whenever the WebSocket upgrade route receives a
non-upgrade request, so every plain HTTP path now returns the
landing page instead of an internal rejection message.

https://claude.ai/code/session_01FMvy3oWhasZwmxnCcch8tN
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Walkthrough

Added a landing page HTML file for the moq-relay service. Modified web.rs to register a fallback handler that serves the landing page for unmatched routes, and updated websocket.rs to accept extraction results instead of direct types. When any extraction fails in the websocket handler—such as non-WebSocket requests or invalid parameters—the landing page is returned instead of propagating an error. The landing page includes metadata, styling, a heading, descriptive text, and a link to moq.dev.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a landing page for non-MoQ clients accessing the relay, which aligns with the actual changeset modifications across landing.html, web.rs, and websocket.rs.
Description check ✅ Passed The description is directly related to the changeset, providing clear context about the landing page addition, fallback handler configuration, WebSocket error handling improvements, and implementation details that match the actual code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/add-moq-relay-dummy-page-1yYQ6
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/add-moq-relay-dummy-page-1yYQ6

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rs/moq-relay/src/landing.html`:
- Around line 62-64: The landing page currently only links to https://moq.dev;
update the paragraph that renders the link (the <p> element containing "See
https://moq.dev for more info.") to also include the specification URL
referenced in the PR objective by adding an additional anchor (or appending the
spec link) alongside the moq.dev link so users can access both the site and the
spec; modify the content of that <p> to include the spec link text and URL.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c0a124ed-4aec-4d5e-9734-6b161ffcc967

📥 Commits

Reviewing files that changed from the base of the PR and between 1dc4789 and b81f424.

📒 Files selected for processing (3)
  • rs/moq-relay/src/landing.html
  • rs/moq-relay/src/web.rs
  • rs/moq-relay/src/websocket.rs

Comment on lines +62 to +64
<p>
See <a href="https://moq.dev">https://moq.dev</a> for more info.
</p>
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 | 🟡 Minor

Add the spec link called out in the PR objective.

The page only points users at moq.dev right now, so the “spec + site” guidance described for this feature is still incomplete.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rs/moq-relay/src/landing.html` around lines 62 - 64, The landing page
currently only links to https://moq.dev; update the paragraph that renders the
link (the <p> element containing "See https://moq.dev for more info.") to also
include the specification URL referenced in the PR objective by adding an
additional anchor (or appending the spec link) alongside the moq.dev link so
users can access both the site and the spec; modify the content of that <p> to
include the spec link text and URL.

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