fix(httpproxy): keep offline connector backendRef in extension-server mode#202
Merged
Merged
Conversation
… mode An offline connector backing an HTTPProxy returned a bare HTTP 500 with an empty body instead of the "Tunnel not online" 503 page the legacy EnvoyPatchPolicy approach served. Root cause: when a connector is not Ready, collectDesiredResources emitted a route rule with `BackendRefs: nil`. In EPP mode that is correct — EG translates the backend-less rule into a virtual_host and the connector EPP (buildConnectorOfflineEnvoyPatches) inserts the direct_response 503 CONNECT route. But in extension-server mode (eppEmissionEnabled: false, now the default on staging and prod) the ext-server keys its offline handling on the presence of a connector *cluster*, which EG only emits when the route rule carries a backendRef. With a null backendRef EG produces no cluster, the ext-server's offline map stays empty, and EG renders the backend-less route as a bare direct_response 500. Fix: only take the null-backendRef path when EPP emission is enabled. In extension-server mode an offline connector now falls through to the same connector.local placeholder EndpointSlice + backendRef as an online connector. EG then renders a connector cluster, the ext-server classifies the connector offline from the replicated Connector Ready condition (index.go keys purely on the Ready condition, ignoring stale connectionDetails), and inserts the 503 "Tunnel not online" route itself — confirmed on the staging data plane, where the ext-server's offline branch already fires once a cluster is present (clusters_offline / vhosts_connector_applied > 0). Adds a Mode-B reconcile test asserting the offline connector route keeps its backendRef and placeholder EndpointSlice and that no EPP is emitted. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
slindseysr
approved these changes
Jun 18, 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.
Problem
An offline connector backing an HTTPProxy serves a bare HTTP 500 with an empty body instead of the "Tunnel not online" 503 page the legacy EnvoyPatchPolicy (EPP) approach used to serve.
Confirmed live:
tear-backing-9r3fd.datumproxy.net→HTTP 500, empty body. Its connectordatum-connect-mhxj5isReady=False / ConnectorNotReady("Connector lease has expired. Agent may be offline.").direct_response: { status: 500 }— noconnect_matcher, no 503, no connector cluster.Root cause
When a connector is not
Ready,collectDesiredResourcesemitted the route rule withBackendRefs: nil.buildConnectorOfflineEnvoyPatchesinserts thedirect_response503 CONNECT route.eppEmissionEnabled: false, now the default on staging and prod): the ext-server keys its offline handling on the presence of a connector cluster, which EG only emits when the route rule carries abackendRef. With a null backendRef, EG produces no cluster, the ext-server's offline map stays empty (ApplyConnectorRoutesfinds nothing to key on), and EG renders the backend-less route as a baredirect_response 500.The ext-server's offline branch itself works — on staging it fires (
clusters_offline/vhosts_connector_applied> 0) once a cluster is present. It classifies online/offline purely from the replicatedConnectorReadycondition (internal/extensionserver/cache/index.go), ignoring staleconnectionDetails. The only missing ingredient is the cluster.Fix
Only take the null-backendRef path when EPP emission is enabled. In extension-server mode an offline connector now falls through to the same
connector.localplaceholder EndpointSlice + backendRef as an online connector. EG renders a connector cluster, and the ext-server inserts the 503 "Tunnel not online" route itself.This also decouples NSO routing from connector readiness in Mode B — NSO emits a stable backendRef regardless of connector state, and the ext-server owns the online/offline decision on every translation.
Test
Adds a Mode-B (
eppEmissionDisabled: true) reconcile case asserting the offline connector route keeps its backendRef + placeholder EndpointSlice and that no EPP is emitted. The existing EPP-mode offline test (default config) is unchanged and still asserts the empty-backendRef + EPP behavior.Notes / follow-ups
connectionDetailswas available to exercise it) — tracked separately.🤖 Generated with Claude Code