Skip to content

web: fix 500 on /banner by using absolute redirect destination#13

Merged
willwashburn merged 1 commit into
mainfrom
claude/agentrelay-banner-500-08sb8w
Jun 27, 2026
Merged

web: fix 500 on /banner by using absolute redirect destination#13
willwashburn merged 1 commit into
mainfrom
claude/agentrelay-banner-500-08sb8w

Conversation

@willwashburn

@willwashburn willwashburn commented Jun 27, 2026

Copy link
Copy Markdown
Member

Problem

https://agentrelay.com/banner returns a 500 Internal Server Error.

/banner is a redirect defined in web/next.config.mjs pointing at the homepage with UTM tags:

destination: '/?utm_source=...&utm_medium=banner&utm_campaign=...'

The site is served via OpenNext on Cloudflare Workers. OpenNext's runtime router parses each redirect destination with getUrlParts(), whose regex treats the empty path segment of a root-relative /?... URL as falsy and falls back to using the entire string (including the ?) as the pathname. It then eagerly hands that to path-to-regexp's compile(), and path-to-regexp v8 throws Unexpected MODIFIER on the bare ? → 500.

The other redirects (/quickstart, /relayfile, …) are unaffected because they have a non-empty path segment and no query string. /banner was the only redirect targeting the root path with a query.

Fix

Point the redirect at the absolute homepage URL:

destination: 'https://agentrelay.com/?utm_source=...&utm_medium=banner&utm_campaign=...'

This routes through OpenNext's external-URL parsing branch, which separates path (/) and query correctly, so compile() never sees the stray ?. The UTM tags and the temporary (307) redirect semantics are preserved. A comment documents why the absolute form is required.

Verification

  • Reproduced the 500 on a local OpenNext/Cloudflare preview build before the change.
  • After the fix, rebuilt (next build + opennextjs-cloudflare build) and confirmed /banner returns 307 → https://agentrelay.com/?utm_source=....
  • All 21 web tests pass (vitest run).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KR8qT4wbqAZMLjqU2D4JGG


Generated by Claude Code


Summary by cubic

Fixes a 500 on /banner by switching the redirect to an absolute homepage URL. The route now returns a 307 to the UTM-tagged homepage instead of failing.

  • Bug Fixes
    • Use an absolute URL for /banner to avoid a path-to-regexp error in OpenNext when parsing root-relative /?... destinations.
    • Behavior preserved: temporary 307 and UTM params; verified /banner now redirects as expected.

Written for commit 2e1eeeb. Summary will update on new commits.

Review in cubic

The /banner redirect 500s under the OpenNext/Cloudflare runtime. Its URL
parser treats the empty path segment of a root-relative '/?utm_...'
destination as the entire string and hands '/?...' to path-to-regexp,
which throws "Unexpected MODIFIER" on the bare '?'. Pointing the redirect
at the absolute homepage URL routes through the external-URL parsing
branch, which splits the path and query correctly.

Verified against an OpenNext preview build: /banner now returns 307 to the
UTM-tagged homepage instead of 500.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KR8qT4wbqAZMLjqU2D4JGG
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@willwashburn, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 8 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e3d11903-67a8-40e8-9344-9426a13a78d3

📥 Commits

Reviewing files that changed from the base of the PR and between 6203015 and 2e1eeeb.

📒 Files selected for processing (1)
  • web/next.config.mjs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/agentrelay-banner-500-08sb8w

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the /banner redirect destination in web/next.config.mjs to use an absolute URL instead of a relative path, resolving a 500 error in the OpenNext/Cloudflare runtime. The reviewer suggested dynamically determining the base URL using environment variables to prevent breaking redirects during local development and in preview environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread web/next.config.mjs
Comment on lines 62 to +63
destination:
'/?utm_source=ai-engineer-worldfair&utm_medium=banner&utm_campaign=ai-engineer-worldfair-2026',
'https://agentrelay.com/?utm_source=ai-engineer-worldfair&utm_medium=banner&utm_campaign=ai-engineer-worldfair-2026',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Hardcoding the production domain https://agentrelay.com breaks the redirect during local development (where it will redirect to production instead of localhost) and in preview/staging environments.

To make this robust across all environments, consider dynamically determining the base URL using environment variables (like NEXT_PUBLIC_SITE_URL) and falling back to http://localhost:3000 in development.

Suggested change
destination:
'/?utm_source=ai-engineer-worldfair&utm_medium=banner&utm_campaign=ai-engineer-worldfair-2026',
'https://agentrelay.com/?utm_source=ai-engineer-worldfair&utm_medium=banner&utm_campaign=ai-engineer-worldfair-2026',
destination:
`${process.env.NEXT_PUBLIC_SITE_URL || (process.env.NODE_ENV === 'development' ? 'http://localhost:3000' : 'https://agentrelay.com')}/?utm_source=ai-engineer-worldfair&utm_medium=banner&utm_campaign=ai-engineer-worldfair-2026`,

@github-actions

Copy link
Copy Markdown
Contributor

Preview deployed!

Environment URL
Web https://b7712f83-agentrelay-web.agent-workforce.workers.dev

This is a Cloudflare Workers preview version of this PR's build.

@willwashburn willwashburn merged commit d451db0 into main Jun 27, 2026
3 checks passed
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