NetBird login loop / 404 on Keycloak auth endpoint when both services share the same parent domain #6376
-
Before posting
Affected areaLogin / Authentication / IdP Deployment typeSelf-hosted - quickstart script Operating system or environmentLinux NetBird version and upgrade status0.65 Did this work before?Not sure Regression detailsNo response SummaryWhen NetBird's embedded Dex redirects the browser to Keycloak for authentication, the Keycloak auth endpoint returns 404. The browser loops back to the NetBird login page without completing authentication. Current behaviorKeycloak auth endpoint returns 404. Keycloak logs show: This indicates query parameters are being stripped before reaching Keycloak's application layer. Expected behaviorBrowser is redirected to Keycloak login page, user authenticates, and is returned to NetBird dashboard with a valid session. Steps to reproduce
Environment and topologyDeployment Topology Edge load balancer (TCP/SNI passthrough) sitting in front of two backend nodes on a private network:
Both nodes are on the same private subnet, virtualised on a hypervisor cluster. NetBird Stack (Node 2)
Identity Provider (Node 1)
Network Flow Key Constraints
Self-hosted details, if availableNo response Logs, status output, or debug evidence**Nginx Error Log — gRPC Connection Reset**
[error] recv() failed (104: Unknown error) while reading response header
from upstream, request: "POST /management.ManagementService/GetServerKey
HTTP/2.0", upstream: "grpc://127.0.0.1:<port>"
[error] recv() failed (104: Unknown error) while reading response header
from upstream, request: "POST /signalexchange.SignalExchange/Send HTTP/2.0",
upstream: "grpc://127.0.0.1:<port>"NetBird Server Log — gRPC Context Cancelled (normal, not actionable) NetBird Server Log — Dex IdP Error (Keycloak redirect URI mismatch) Keycloak Log — Query Parameter Stripping by Apache Keycloak Log — Unrelated (other services, masked) Browser — Failed Request Chain |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
This is an Apache config bug, not a NetBird bug. Your own logs name the cause: the query string is being stripped at the Apache reverse proxy in front of Keycloak. The browser request leaving NetBird is correct (it has Fix: make the Apache proxy preserve the query string. Common culprits:
The On the "different parent domain fixes it" workaround: that's almost certainly coincidental. Changing the domain likely routed the request through a different vhost / proxy block that happened to preserve the query string. The shared parent domain and the sec-fetch-site angle are a separate concern from the 404, and chasing them won't fix the param stripping. Also worth checking (separate issue): Your redirect_uri differs between requests (/nb-auth vs /oauth2/callback). Make sure the Keycloak client's allowed redirect URIs match exactly what NetBird/Dex sends, or you'll hit a different failure once the proxy is fixed. |
Beta Was this translation helpful? Give feedback.
This is HTTP/2 connection coalescing, which also explains why a different parent domain fixes it.
Two conditions are both true in your setup:
Per RFC 7540 §9.1.1, when both hold, Chrome/Firefox may send
keycloak.example.comrequests over the already-open connection tonetbird.example.comwith no new TLS handshake, so no new SNI. Your L4 load balancer routes purely on SNI, so it can't re-route that coalesced request. It lands on the NetBird backend's Nginx, which has no/realms/<realm>/protocol/openid-connect/authroute and returns your 404.This fits the evidence better than sec-fetch…