From ac45e4b3ab5f294ee237413520337d3259055819 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 31 Oct 2026 02:37:28 +0000 Subject: [PATCH 1/6] test(relay): reproduce drifted managed tunnel ingress (#27952) These tests reproduce #27952: reconcileOrigin returns ready when the allocation origin matches, without checking that the tunnel's live Cloudflare ingress still points at that origin. Co-Authored-By: Claude Opus 5.5 --- .../ManagedEndpointProvider.test.ts | 58 ++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/infra/relay/src/environments/ManagedEndpointProvider.test.ts b/infra/relay/src/environments/ManagedEndpointProvider.test.ts index 96661fad42a61..e1c3212f35598 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.test.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.test.ts @@ -35,10 +35,21 @@ const config = RelayConfiguration.RelayConfiguration.of({ }); interface TunnelCall { - readonly operation: "get" | "list" | "create" | "putConfiguration" | "getToken" | "delete"; + readonly operation: + | "get" + | "list" + | "create" + | "putConfiguration" + | "getConfiguration" + | "getToken" + | "delete"; readonly input: unknown; } +interface TunnelConfiguration { + readonly ingress: ReadonlyArray<{ readonly hostname?: string; readonly service: string }>; +} + interface DnsCall { readonly operation: "listRecords" | "createRecord" | "updateRecord" | "deleteRecord"; readonly input: unknown; @@ -99,7 +110,10 @@ function makeTunnelClient(calls: TunnelCall[] = []) { }); } -function makePersistentTunnelClient(calls: TunnelCall[] = []) { +function makePersistentTunnelClient( + calls: TunnelCall[] = [], + configuration: { current: TunnelConfiguration | null } = { current: null }, +) { let tunnel: { readonly id: string; readonly name: string } | null = null; return ManagedEndpointProvider.ManagedEndpointTunnelClient.of({ get: (tunnelId) => @@ -133,6 +147,12 @@ function makePersistentTunnelClient(calls: TunnelCall[] = []) { putConfiguration: (tunnelId, tunnelConfig) => Effect.sync(() => { calls.push({ operation: "putConfiguration", input: { tunnelId, tunnelConfig } }); + configuration.current = tunnelConfig; + }), + getConfiguration: (tunnelId: string) => + Effect.sync(() => { + calls.push({ operation: "getConfiguration", input: tunnelId }); + return configuration.current ?? { ingress: [] }; }), getToken: (tunnelId) => Effect.sync(() => { @@ -1111,6 +1131,40 @@ describe("ManagedEndpointProvider", () => { }).pipe(Effect.provide(layer)); }); + it.effect("restores Cloudflare ingress that drifted from the recorded origin", () => { + const tunnelCalls: TunnelCall[] = []; + const configuration: { current: TunnelConfiguration | null } = { current: null }; + const layer = layerProvider(makePersistentTunnelClient(tunnelCalls, configuration)); + + return Effect.gen(function* () { + const provider = yield* ManagedEndpointProvider.ManagedEndpointProvider; + const key = { userId: "user_ABC", environmentId: "env_ABC" } as const; + const origin = { localHttpHost: "127.0.0.1", localHttpPort: 3773 } as const; + const provisioned = yield* provider.provision({ ...key, origin }); + configuration.current = { + ingress: [ + { hostname: expectedManagedHostname("env_ABC"), service: "http://127.0.0.1:4711" }, + { service: "http_status:404" }, + ], + }; + + expect( + yield* provider.reconcileOrigin({ + ...key, + tunnelId: provisioned.runtime.tunnelId!, + origin, + endpoint: provisioned.endpoint, + }), + ).toBe("ready"); + expect(configuration.current).toEqual({ + ingress: [ + { hostname: expectedManagedHostname("env_ABC"), service: "http://127.0.0.1:3773" }, + { service: "http_status:404" }, + ], + }); + }).pipe(Effect.provide(layer)); + }); + it.effect("rejects an active endpoint that does not match the allocation hostname", () => { const layer = layerProvider(makePersistentTunnelClient()); From 61310ebfaad17c50d2d5b8b50a4cfbbef53d7315 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 31 Oct 2026 02:41:12 +0000 Subject: [PATCH 2/6] fix(relay): restore drifted tunnel ingress when the origin matches reconcileOrigin returned ready as soon as the allocation's recorded origin matched the host's, without reading the tunnel's live Cloudflare ingress. An ingress that drifted to another port stayed broken across restarts. On a matching origin the relay now reads the tunnel configuration and returns ready only when the hostname's ingress rule already serves the origin; otherwise it takes the existing claimed rewrite path. A missing configuration asks for recovery, like a missing tunnel. Fixes pingdotgg/t3code#27952 Co-Authored-By: Claude Opus 5.5 --- .../ManagedEndpointProvider.test.ts | 28 +++++++ .../environments/ManagedEndpointProvider.ts | 77 +++++++++++++------ .../ManagedEndpointReaper.test.ts | 1 + 3 files changed, 84 insertions(+), 22 deletions(-) diff --git a/infra/relay/src/environments/ManagedEndpointProvider.test.ts b/infra/relay/src/environments/ManagedEndpointProvider.test.ts index e1c3212f35598..aa358ef67781a 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.test.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.test.ts @@ -98,6 +98,11 @@ function makeTunnelClient(calls: TunnelCall[] = []) { Effect.sync(() => { calls.push({ operation: "putConfiguration", input: { tunnelId, tunnelConfig } }); }), + getConfiguration: (tunnelId) => + Effect.sync(() => { + calls.push({ operation: "getConfiguration", input: tunnelId }); + return { ingress: [] }; + }), getToken: (tunnelId) => Effect.sync(() => { calls.push({ operation: "getToken", input: tunnelId }); @@ -1165,6 +1170,29 @@ describe("ManagedEndpointProvider", () => { }).pipe(Effect.provide(layer)); }); + it.effect("does not rewrite Cloudflare ingress that already serves the recorded origin", () => { + const tunnelCalls: TunnelCall[] = []; + const layer = layerProvider(makePersistentTunnelClient(tunnelCalls)); + + return Effect.gen(function* () { + const provider = yield* ManagedEndpointProvider.ManagedEndpointProvider; + const key = { userId: "user_ABC", environmentId: "env_ABC" } as const; + const origin = { localHttpHost: "127.0.0.1", localHttpPort: 3773 } as const; + const provisioned = yield* provider.provision({ ...key, origin }); + tunnelCalls.length = 0; + + expect( + yield* provider.reconcileOrigin({ + ...key, + tunnelId: provisioned.runtime.tunnelId!, + origin, + endpoint: provisioned.endpoint, + }), + ).toBe("ready"); + expect(tunnelCalls.map((call) => call.operation)).toEqual(["get", "getConfiguration"]); + }).pipe(Effect.provide(layer)); + }); + it.effect("rejects an active endpoint that does not match the allocation hostname", () => { const layer = layerProvider(makePersistentTunnelClient()); diff --git a/infra/relay/src/environments/ManagedEndpointProvider.ts b/infra/relay/src/environments/ManagedEndpointProvider.ts index 9a76b9c09981a..9ee6c6cd28ba2 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.ts @@ -216,6 +216,7 @@ const ManagedEndpointTunnelClientOperation = Schema.Literals([ "list", "create", "put-configuration", + "get-configuration", "get-token", "delete", ]); @@ -265,6 +266,15 @@ export class ManagedEndpointTunnelClient extends Context.Service< }>; }, ) => Effect.Effect; + readonly getConfiguration: (tunnelId: string) => Effect.Effect< + { + readonly ingress: ReadonlyArray<{ + readonly hostname?: string | null; + readonly service: string; + }>; + }, + ManagedEndpointTunnelClientError + >; readonly getToken: ( tunnelId: string, ) => Effect.Effect; @@ -756,32 +766,46 @@ const make = Effect.gen(function* () { hostname: allocation.hostname, }); } + const verifyTunnel = (read: Effect.Effect) => + read.pipe( + Effect.asSome, + Effect.catchTags({ + ManagedEndpointTunnelClientError: (cause) => + isManagedEndpointNotFound(cause.cause) + ? Effect.succeedNone + : Effect.fail( + new ManagedEndpointProvisioningFailed({ + userId: input.userId, + environmentId: input.environmentId, + stage: "verify-tunnel", + tunnelId: input.tunnelId, + cause, + }), + ), + }), + ); // Released records retain tunnel ids; verify Cloudflare still has the tunnel before reconnecting. - const recorded = yield* tunnels.get(input.tunnelId).pipe( - Effect.asSome, - Effect.catchTags({ - ManagedEndpointTunnelClientError: (cause) => - isManagedEndpointNotFound(cause.cause) - ? Effect.succeedNone - : Effect.fail( - new ManagedEndpointProvisioningFailed({ - userId: input.userId, - environmentId: input.environmentId, - stage: "verify-tunnel", - tunnelId: input.tunnelId, - cause, - }), - ), - }), - ); + const recorded = yield* verifyTunnel(tunnels.get(input.tunnelId)); if (Option.isNone(recorded) || recorded.value.deletedAt) { return "recovery_required"; } + const originService = formatOriginService(input.origin); if ( allocation.origin?.localHttpHost === input.origin.localHttpHost && allocation.origin.localHttpPort === input.origin.localHttpPort ) { - return "ready"; + // Live ingress can drift from the recorded origin; only a matching rule skips the rewrite. + const configuration = yield* verifyTunnel(tunnels.getConfiguration(input.tunnelId)); + if (Option.isNone(configuration)) { + return "recovery_required"; + } + const hostname = normalizeHostname(allocation.hostname); + const rule = configuration.value.ingress.find( + (entry) => entry.hostname != null && normalizeHostname(entry.hostname) === hostname, + ); + if (rule?.service === originService) { + return "ready"; + } } const updated = yield* allocations @@ -795,10 +819,7 @@ const make = Effect.gen(function* () { tunnels .putConfiguration(input.tunnelId, { ingress: [ - { - hostname: allocation.hostname, - service: formatOriginService(input.origin), - }, + { hostname: allocation.hostname, service: originService }, { service: "http_status:404" }, ], }) @@ -1603,6 +1624,18 @@ export const layerCloudflareBindings = ( }), ), ), + getConfiguration: (tunnelId) => + gate(tunnelClient.getConfiguration(tunnelId)).pipe( + Effect.map(({ config }) => ({ ingress: config?.ingress ?? [] })), + Effect.mapError( + (cause) => + new ManagedEndpointTunnelClientError({ + operation: "get-configuration", + tunnelId, + cause, + }), + ), + ), getToken: (tunnelId) => gate(tunnelClient.getToken(tunnelId)).pipe( Effect.mapError( diff --git a/infra/relay/src/environments/ManagedEndpointReaper.test.ts b/infra/relay/src/environments/ManagedEndpointReaper.test.ts index d2a9bb7f6c3b0..5ce24e6b7e5c1 100644 --- a/infra/relay/src/environments/ManagedEndpointReaper.test.ts +++ b/infra/relay/src/environments/ManagedEndpointReaper.test.ts @@ -140,6 +140,7 @@ function harness(input?: { }), create: () => Effect.die("unused"), putConfiguration: () => Effect.die("unused"), + getConfiguration: () => Effect.die("unused"), getToken: () => Effect.die("unused"), delete: (tunnelId) => input?.failAllDeletes === true || From bb81e46d5a1855dc06c387cc4924197585db6a6f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 31 Oct 2026 02:48:12 +0000 Subject: [PATCH 3/6] fix(relay): a tunnel without remote configuration gets its ingress rewritten Cloudflare reports a missing tunnel configuration as TunnelConfigurationNotFound (code 1055) rather than a 404, so the config read failed registration instead of falling through to the rewrite. Read it as empty ingress at the binding. Co-Authored-By: Claude Opus 5.5 --- .../ManagedEndpointProvider.test.ts | 39 +++++++++++++++++++ .../environments/ManagedEndpointProvider.ts | 4 ++ 2 files changed, 43 insertions(+) diff --git a/infra/relay/src/environments/ManagedEndpointProvider.test.ts b/infra/relay/src/environments/ManagedEndpointProvider.test.ts index aa358ef67781a..5003599a579cf 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.test.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.test.ts @@ -3,6 +3,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices"; import { describe, expect, it } from "@effect/vitest"; import * as Alchemy from "alchemy"; import * as Cloudflare from "@alchemy.run/cloudflare"; +import * as ZeroTrust from "@distilled.cloud/cloudflare/zero-trust"; import * as Deferred from "effect/Deferred"; import * as Effect from "effect/Effect"; import * as Fiber from "effect/Fiber"; @@ -800,6 +801,44 @@ describe("ManagedEndpointProvider", () => { }); }); + it.effect("reads a tunnel without remote configuration as having no ingress", () => { + const tunnelClient = { + getConfiguration: () => + Effect.fail( + new ZeroTrust.TunnelConfigurationNotFound({ + code: 1055, + message: "Tunnel configuration not found", + }), + ), + } as unknown as Cloudflare.Tunnel.ReadWriteTunnelClient; + const layer = ManagedEndpointProvider.layerCloudflareBindings( + tunnelClient, + {} as Cloudflare.DNS.ReadWriteDnsClient, + {} as Alchemy.BaseRuntimeContext, + ).pipe( + Layer.provideMerge(NodeServices.layer), + Layer.provide(RelayConfiguration.layer(config)), + Layer.provide( + Layer.succeed(ManagedEndpointAllocations.ManagedEndpointAllocations, makeAllocations()), + ), + Layer.provide(Layer.succeed(ManagedTunnelLimits.ManagedTunnelLimits, makeTunnelLimits())), + Layer.provide( + Layer.succeed( + CloudflareApiPause.CloudflareApiPause, + CloudflareApiPause.CloudflareApiPause.of({ + pausedUntilMillis: Effect.succeed(0), + pauseUntil: () => Effect.void, + }), + ), + ), + ); + + return Effect.gen(function* () { + const tunnels = yield* ManagedEndpointProvider.ManagedEndpointTunnelClient; + expect(yield* tunnels.getConfiguration("tunnel-id")).toEqual({ ingress: [] }); + }).pipe(Effect.provide(layer)); + }); + it.effect("does not hide non-not-found checkpoint update failures", () => { const dnsCalls: DnsCall[] = []; const failure = new ManagedEndpointProvider.ManagedEndpointDnsClientError({ diff --git a/infra/relay/src/environments/ManagedEndpointProvider.ts b/infra/relay/src/environments/ManagedEndpointProvider.ts index 9ee6c6cd28ba2..41e83aaa70349 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.ts @@ -1627,6 +1627,10 @@ export const layerCloudflareBindings = ( getConfiguration: (tunnelId) => gate(tunnelClient.getConfiguration(tunnelId)).pipe( Effect.map(({ config }) => ({ ingress: config?.ingress ?? [] })), + // Cloudflare reports a tunnel without remote configuration as code 1055, not 404. + Effect.catchTags({ + TunnelConfigurationNotFound: () => Effect.succeed({ ingress: [] }), + }), Effect.mapError( (cause) => new ManagedEndpointTunnelClientError({ From dd118a035db41bc0dfea8a36529d5eb6a97daa9e Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 31 Oct 2026 02:59:18 +0000 Subject: [PATCH 4/6] test(relay): fold the no-rewrite check into the drift test Co-Authored-By: Claude Opus 5.5 --- .../ManagedEndpointProvider.test.ts | 44 +++++-------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/infra/relay/src/environments/ManagedEndpointProvider.test.ts b/infra/relay/src/environments/ManagedEndpointProvider.test.ts index 5003599a579cf..5a2c9856a2f22 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.test.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.test.ts @@ -1185,21 +1185,24 @@ describe("ManagedEndpointProvider", () => { const key = { userId: "user_ABC", environmentId: "env_ABC" } as const; const origin = { localHttpHost: "127.0.0.1", localHttpPort: 3773 } as const; const provisioned = yield* provider.provision({ ...key, origin }); + const reconcile = provider.reconcileOrigin({ + ...key, + tunnelId: provisioned.runtime.tunnelId!, + origin, + endpoint: provisioned.endpoint, + }); + tunnelCalls.length = 0; + + expect(yield* reconcile).toBe("ready"); + expect(tunnelCalls.map((call) => call.operation)).toEqual(["get", "getConfiguration"]); + configuration.current = { ingress: [ { hostname: expectedManagedHostname("env_ABC"), service: "http://127.0.0.1:4711" }, { service: "http_status:404" }, ], }; - - expect( - yield* provider.reconcileOrigin({ - ...key, - tunnelId: provisioned.runtime.tunnelId!, - origin, - endpoint: provisioned.endpoint, - }), - ).toBe("ready"); + expect(yield* reconcile).toBe("ready"); expect(configuration.current).toEqual({ ingress: [ { hostname: expectedManagedHostname("env_ABC"), service: "http://127.0.0.1:3773" }, @@ -1209,29 +1212,6 @@ describe("ManagedEndpointProvider", () => { }).pipe(Effect.provide(layer)); }); - it.effect("does not rewrite Cloudflare ingress that already serves the recorded origin", () => { - const tunnelCalls: TunnelCall[] = []; - const layer = layerProvider(makePersistentTunnelClient(tunnelCalls)); - - return Effect.gen(function* () { - const provider = yield* ManagedEndpointProvider.ManagedEndpointProvider; - const key = { userId: "user_ABC", environmentId: "env_ABC" } as const; - const origin = { localHttpHost: "127.0.0.1", localHttpPort: 3773 } as const; - const provisioned = yield* provider.provision({ ...key, origin }); - tunnelCalls.length = 0; - - expect( - yield* provider.reconcileOrigin({ - ...key, - tunnelId: provisioned.runtime.tunnelId!, - origin, - endpoint: provisioned.endpoint, - }), - ).toBe("ready"); - expect(tunnelCalls.map((call) => call.operation)).toEqual(["get", "getConfiguration"]); - }).pipe(Effect.provide(layer)); - }); - it.effect("rejects an active endpoint that does not match the allocation hostname", () => { const layer = layerProvider(makePersistentTunnelClient()); From ece298e34eac38353d2a2bd721dd6c06d8809538 Mon Sep 17 00:00:00 2001 From: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Date: Mon, 2 Nov 2026 18:08:42 -0800 Subject: [PATCH 5/6] fix(relay): repair tunnel ingress shadowed by an earlier wildcard or catch-all rule Also provide NodeCrypto to the missing-configuration test after the Effect 4.1.2 upgrade. Co-Authored-By: Claude Opus 5.5 --- .../environments/ManagedEndpointProvider.test.ts | 15 ++++++++++++++- .../src/environments/ManagedEndpointProvider.ts | 12 +++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/infra/relay/src/environments/ManagedEndpointProvider.test.ts b/infra/relay/src/environments/ManagedEndpointProvider.test.ts index f807614533814..3485a48c97e72 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.test.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.test.ts @@ -828,7 +828,7 @@ describe("ManagedEndpointProvider", () => { {} as Cloudflare.DNS.ReadWriteDnsClient, {} as Alchemy.BaseRuntimeContext, ).pipe( - Layer.provideMerge(NodeServices.layer), + Layer.provideMerge(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)), Layer.provide(RelayConfiguration.layer(config)), Layer.provide( Layer.succeed(ManagedEndpointAllocations.ManagedEndpointAllocations, makeAllocations()), @@ -1237,6 +1237,19 @@ describe("ManagedEndpointProvider", () => { { service: "http_status:404" }, ], }); + + configuration.current = { + ingress: [ + { hostname: "*.t3code.test", service: "http://127.0.0.1:4711" }, + { hostname: expectedManagedHostname("env_ABC"), service: "http://127.0.0.1:3773" }, + { service: "http_status:404" }, + ], + }; + expect(yield* reconcile).toBe("ready"); + expect(configuration.current.ingress[0]).toEqual({ + hostname: expectedManagedHostname("env_ABC"), + service: "http://127.0.0.1:3773", + }); }).pipe(Effect.provide(layer)); }); diff --git a/infra/relay/src/environments/ManagedEndpointProvider.ts b/infra/relay/src/environments/ManagedEndpointProvider.ts index 5bbe332cdc442..c4fbafb9f8130 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.ts @@ -800,9 +800,15 @@ const make = Effect.gen(function* () { return "recovery_required"; } const hostname = normalizeHostname(allocation.hostname); - const rule = configuration.value.ingress.find( - (entry) => entry.hostname != null && normalizeHostname(entry.hostname) === hostname, - ); + // Cloudflare routes by the first matching rule, so an earlier wildcard or catch-all wins. + const rule = configuration.value.ingress.find((entry) => { + if (entry.hostname == null) return true; + const candidate = normalizeHostname(entry.hostname); + return ( + candidate === hostname || + (candidate.startsWith("*.") && hostname.endsWith(candidate.slice(1))) + ); + }); if (rule?.service === originService) { return "ready"; } From 9920d41dbd51e995757dbe9f35227e350dc03c2c Mon Sep 17 00:00:00 2001 From: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Date: Mon, 2 Nov 2026 18:38:02 -0800 Subject: [PATCH 6/6] fix(relay): path-restricted ingress no longer counts as a ready route Co-Authored-By: Claude Opus 5.5 --- .../ManagedEndpointProvider.test.ts | 22 ++++++++++++++++++- .../environments/ManagedEndpointProvider.ts | 4 +++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/infra/relay/src/environments/ManagedEndpointProvider.test.ts b/infra/relay/src/environments/ManagedEndpointProvider.test.ts index 3485a48c97e72..3e360d8f62160 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.test.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.test.ts @@ -49,7 +49,11 @@ interface TunnelCall { } interface TunnelConfiguration { - readonly ingress: ReadonlyArray<{ readonly hostname?: string; readonly service: string }>; + readonly ingress: ReadonlyArray<{ + readonly hostname?: string; + readonly path?: string; + readonly service: string; + }>; } interface DnsCall { @@ -1250,6 +1254,22 @@ describe("ManagedEndpointProvider", () => { hostname: expectedManagedHostname("env_ABC"), service: "http://127.0.0.1:3773", }); + + configuration.current = { + ingress: [ + { + hostname: expectedManagedHostname("env_ABC"), + path: "/api", + service: "http://127.0.0.1:3773", + }, + { service: "http_status:404" }, + ], + }; + expect(yield* reconcile).toBe("ready"); + expect(configuration.current.ingress[0]).toEqual({ + hostname: expectedManagedHostname("env_ABC"), + service: "http://127.0.0.1:3773", + }); }).pipe(Effect.provide(layer)); }); diff --git a/infra/relay/src/environments/ManagedEndpointProvider.ts b/infra/relay/src/environments/ManagedEndpointProvider.ts index c4fbafb9f8130..188ad0e7b7148 100644 --- a/infra/relay/src/environments/ManagedEndpointProvider.ts +++ b/infra/relay/src/environments/ManagedEndpointProvider.ts @@ -270,6 +270,7 @@ export class ManagedEndpointTunnelClient extends Context.Service< { readonly ingress: ReadonlyArray<{ readonly hostname?: string | null; + readonly path?: string | null; readonly service: string; }>; }, @@ -809,7 +810,8 @@ const make = Effect.gen(function* () { (candidate.startsWith("*.") && hostname.endsWith(candidate.slice(1))) ); }); - if (rule?.service === originService) { + // A path-restricted rule leaves other paths to later rules, so it cannot prove routing. + if (rule?.service === originService && !rule.path) { return "ready"; } }