fix: correct stale app.netbird.io management URL (#401)#408
Conversation
) Older installs persisted https://app.netbird.io (the dashboard host) as the Management URL in config.json. That host only serves the web UI and does not negotiate the HTTP/2 ALPN the management gRPC service requires, so the client fails with "missing selected ALPN property" and never connects. NetBird's built-in migration ignores this host, so the service script now rewrites it to https://api.netbird.io when the user has set no management_url of their own. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 reviews. How do review 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 refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe NetBird startup script checks persisted configuration when ChangesManagement URL self-healing
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a NetBird Cloud connectivity failure caused by a stale persisted management_url pointing to https://app.netbird.io (dashboard) instead of the gRPC management API endpoint https://api.netbird.io, which can trigger TLS/ALPN handshake failures for gRPC.
Changes:
- Adds a startup-time “self-heal” in the s6 run script: when the user has not configured
management_urland/config/config.jsoncontainsManagementURL.Hostunderapp.netbird.io, it forces--management-url https://api.netbird.io. - Logs a warning when performing the auto-correction, relying on NetBird to persist the corrected value afterward.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@netbird/rootfs/etc/s6-overlay/s6-rc.d/netbird/run`:
- Around line 35-41: Update the jq filter in the management URL self-healing
block to read the flat .ManagementURL string instead of .ManagementURL.Host,
while preserving the existing app.netbird.io host check and correction to
https://api.netbird.io.
🪄 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: 6172cef5-ec8d-4e16-909f-5ffb88bbe03b
📒 Files selected for processing (1)
netbird/rootfs/etc/s6-overlay/s6-rc.d/netbird/run
The persisted NetBird config.json stores ManagementURL as a flat string (e.g. https://app.netbird.io:443), not a nested object. The previous .ManagementURL.Host jq filter always returned empty, so the self-heal never triggered. Read the string and derive the host from it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Revert an incorrect review suggestion. NetBird persists ManagementURL as a nested object (net/url.URL marshals via reflected struct fields, not as a string), so the host lives at .ManagementURL.Host. Verified empirically with a Go json.Marshal test and confirmed bash -n + shellcheck clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Fixes #401. Affected NetBird Cloud users fail to connect with a gRPC TLS error:
authentication handshake failed: credentials: cannot check peer: missing selected ALPN property.Root cause: the client dials
app.netbird.io:443(the web dashboard) for theManagement gRPC service instead of
api.netbird.io:443(the management API).app.netbird.iois fronted by a proxy that terminates TLS for the browser UIwithout negotiating the HTTP/2
h2ALPN that gRPC-go >= 1.67 enforces, so thehandshake aborts. The wrong host is a stale value persisted in
/config/config.jsonfrom an older setup; the add-on leaves
management_urlempty and never passes--management-url, so NetBird keeps the persisted value rather than its correctbuilt-in default (
api.netbird.io). NetBird's ownUpdateOldManagementURLmigration only rewrites
api.netbird.io/api.wiretrustee.comhosts, so anapp.netbird.iovalue is never auto-corrected.Fix: the service script now self-heals — when the user has set no
management_urland the persisted Management host is
app.netbird.io, it passes--management-url https://api.netbird.io. NetBird then rewrites and persists thecorrected URL. Self-hosted users (who set a non-empty
management_url) are untouched,and the rewrite is idempotent on later boots.
Test Plan
bash -nandshellcheckon the modified service script: clean.config.jsonshapes:stale
app.netbird.iowith/without:443port -> corrected;api.netbird.io,self-hosted host, missing
ManagementURL, and missing config file -> left untouched.api.netbird.ioandapp.netbird.iois only the admin/dashboard URL.
🤖 Generated with Claude Code
Summary by CodeRabbit