@jakuta-inc/worker-proxy 6.0.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/same-origin-proxy.d.ts +28 -13
- package/dist/same-origin-proxy.d.ts.map +1 -1
- package/dist/same-origin-proxy.js +55 -35
- package/dist/same-origin-proxy.js.map +1 -1
- package/dist/venture_api_route.d.ts +5 -7
- package/dist/venture_api_route.d.ts.map +1 -1
- package/dist/venture_api_route.js +3 -5
- package/dist/venture_api_route.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AllowedHosts, Backend, PathRewrite,
|
|
2
|
-
export { createProxyHandler, createAdminAuthRoute } from "./same-origin-proxy.js";
|
|
1
|
+
export type { AllowedHosts, Backend, PathRewrite, ProxyRoute, HealthProbeResult, ProxyHealthCheck, ProxyHandlerConfig, ProxyOutcome, ProxyHandler, ProxyError } from "./same-origin-proxy.js";
|
|
2
|
+
export { createProxyHandler, createAdminAuthRoute, createAdminApiAuthRoute } from "./same-origin-proxy.js";
|
|
3
3
|
export { VENTURE_API_PREFIX, createVentureApiRoute } from "./venture_api_route.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9L,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createProxyHandler, createAdminAuthRoute } from "./same-origin-proxy.js";
|
|
1
|
+
export { createProxyHandler, createAdminAuthRoute, createAdminApiAuthRoute } from "./same-origin-proxy.js";
|
|
2
2
|
export { VENTURE_API_PREFIX, createVentureApiRoute } from "./venture_api_route.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -28,11 +28,11 @@ interface BackendBase {
|
|
|
28
28
|
* - `"venture"` — a venture backend must never see the raw `admin_session`
|
|
29
29
|
* cookie. The proxy deletes the `Cookie` header and, if an `admin_session`
|
|
30
30
|
* was present, injects `X-Admin-Session: <session_id>` carrying the raw
|
|
31
|
-
* session id for `admin-
|
|
31
|
+
* session id for `admin-shared`'s `extract_session_from_handoff_header`.
|
|
32
32
|
* Any inbound `X-Admin-Session` header is stripped first (forgery defense).
|
|
33
33
|
*
|
|
34
34
|
* Cookie-transform semantics are an attribute of the Backend, not of the
|
|
35
|
-
*
|
|
35
|
+
* ProxyRoute. There is no per-route override. Any caller that could point a route
|
|
36
36
|
* at the admin backend while running the venture cookie-stripping transform
|
|
37
37
|
* would break web session restore on admin-api; attaching the transform to
|
|
38
38
|
* backend identity makes that state unrepresentable.
|
|
@@ -46,7 +46,7 @@ export type Backend = (BackendBase & {
|
|
|
46
46
|
* A path-rewrite policy applied to the incoming pathname before forwarding.
|
|
47
47
|
* Either an identity passthrough or an explicit transform function. Encoded
|
|
48
48
|
* as a discriminated union so `createProxyHandler` callers cannot omit the
|
|
49
|
-
* decision — every
|
|
49
|
+
* decision — every ProxyRoute states its rewrite policy explicitly.
|
|
50
50
|
*/
|
|
51
51
|
export type PathRewrite = {
|
|
52
52
|
readonly kind: "identity";
|
|
@@ -63,7 +63,7 @@ export type PathRewrite = {
|
|
|
63
63
|
* @field target - Backend to forward matched requests to
|
|
64
64
|
* @field rewrite - Path rewrite policy applied before forwarding
|
|
65
65
|
*/
|
|
66
|
-
export interface
|
|
66
|
+
export interface ProxyRoute {
|
|
67
67
|
readonly pathPrefix: string;
|
|
68
68
|
readonly target: Backend;
|
|
69
69
|
readonly rewrite: PathRewrite;
|
|
@@ -71,11 +71,11 @@ export interface Route {
|
|
|
71
71
|
/**
|
|
72
72
|
* Result of probing a backend's Jakuta `/status` endpoint.
|
|
73
73
|
*
|
|
74
|
-
* @field
|
|
74
|
+
* @field healthStatus - `"ok"` if the backend responded with a 2xx, `"error"` on non-2xx or network failure
|
|
75
75
|
* @field probeUrl - The full URL that was probed, useful for error reporting
|
|
76
76
|
*/
|
|
77
77
|
export interface HealthProbeResult {
|
|
78
|
-
readonly
|
|
78
|
+
readonly healthStatus: "ok" | "error";
|
|
79
79
|
readonly probeUrl: string;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
@@ -96,9 +96,9 @@ export type ProxyHealthCheck = {
|
|
|
96
96
|
readonly kind: "disabled";
|
|
97
97
|
} | {
|
|
98
98
|
readonly kind: "enabled";
|
|
99
|
-
readonly
|
|
99
|
+
readonly healthPath: string;
|
|
100
100
|
readonly probeTargets: readonly Backend[];
|
|
101
|
-
readonly buildHealthResponse: (
|
|
101
|
+
readonly buildHealthResponse: (healthResults: Record<string, HealthProbeResult>) => Response;
|
|
102
102
|
};
|
|
103
103
|
/**
|
|
104
104
|
* Declarative configuration for `createProxyHandler`.
|
|
@@ -109,7 +109,7 @@ export type ProxyHealthCheck = {
|
|
|
109
109
|
*/
|
|
110
110
|
export interface ProxyHandlerConfig {
|
|
111
111
|
readonly allowedHosts: AllowedHosts;
|
|
112
|
-
readonly routes: readonly
|
|
112
|
+
readonly routes: readonly ProxyRoute[];
|
|
113
113
|
readonly healthCheck: ProxyHealthCheck;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
@@ -145,7 +145,7 @@ export interface ProxyHandler {
|
|
|
145
145
|
handleRequest(workerRequest: Request): Promise<ProxyOutcome>;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
* Build a `
|
|
148
|
+
* Build a `ProxyRoute` that proxies `/auth/*` to the admin backend's `/api/auth/*`
|
|
149
149
|
* surface with cookies preserved. Every frontend that renders admin-shell's
|
|
150
150
|
* login UI needs this route, because admin-shell's `AdminRoute.*` constants
|
|
151
151
|
* (`/auth/login`, `/auth/logout`, `/auth/session`) are the single source of
|
|
@@ -157,14 +157,29 @@ export interface ProxyHandler {
|
|
|
157
157
|
*
|
|
158
158
|
* @why Prevents each Worker from hand-writing the admin login rewrite because admin-shell's browser paths and admin-api's server paths intentionally differ.
|
|
159
159
|
* @param adminBaseUrl - Origin of the jakuta-admin API (scheme + host, no path)
|
|
160
|
-
* @returns A
|
|
160
|
+
* @returns A ProxyRoute that matches `/auth` / `/auth/*` and forwards to `adminBaseUrl/api/auth/*`
|
|
161
161
|
*/
|
|
162
|
-
export declare function createAdminAuthRoute(adminBaseUrl: string):
|
|
162
|
+
export declare function createAdminAuthRoute(adminBaseUrl: string): ProxyRoute;
|
|
163
|
+
/**
|
|
164
|
+
* Build a `ProxyRoute` that proxies generated admin-shell `/api/auth/*` requests
|
|
165
|
+
* to the Central Admin backend with cookies preserved.
|
|
166
|
+
*
|
|
167
|
+
* Mount this before the venture `/api/*` route. The generated admin-shell
|
|
168
|
+
* auth client now uses the same `/api/auth/*` route templates as the Central
|
|
169
|
+
* Admin backend, so the worker should forward those paths without rewriting
|
|
170
|
+
* them or applying venture cookie-to-header handoff.
|
|
171
|
+
*
|
|
172
|
+
* @why Preserves generated admin auth paths because venture workers must route
|
|
173
|
+
* Central Admin session requests before the general venture API proxy.
|
|
174
|
+
* @param adminBaseUrl - Origin of the jakuta-admin API (scheme + host, no path)
|
|
175
|
+
* @returns A ProxyRoute that matches `/api/auth` / `/api/auth/*` and forwards to Central Admin unchanged.
|
|
176
|
+
*/
|
|
177
|
+
export declare function createAdminApiAuthRoute(adminBaseUrl: string): ProxyRoute;
|
|
163
178
|
/**
|
|
164
179
|
* Build a `ProxyHandler` from a declarative `ProxyHandlerConfig`. This is the
|
|
165
180
|
* single handler constructor — there is no separate venture or central-admin
|
|
166
181
|
* handler. Consumers express their routing topology as a list of
|
|
167
|
-
* `
|
|
182
|
+
* `ProxyRoute`s pointing at `Backend`s, and the handler dispatches by first-match.
|
|
168
183
|
*
|
|
169
184
|
* Every config must declare its `allowedHosts` — the non-empty list of
|
|
170
185
|
* hostnames this worker accepts. A request for any other hostname is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"same-origin-proxy.d.ts","sourceRoot":"","sources":["../src/same-origin-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAE1D,UAAU,WAAW;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,OAAO,GACf,CAAC,WAAW,GAAG;IAAE,QAA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;IAC3B,aAAa,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC9D;AAiPD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,CASrE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,CAMxE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CA+D3E"}
|
|
@@ -18,12 +18,12 @@ async function probeHealth(probedBaseUrl) {
|
|
|
18
18
|
signal: AbortSignal.timeout(HEALTH_TIMEOUT_MS),
|
|
19
19
|
});
|
|
20
20
|
if (healthResponse.ok) {
|
|
21
|
-
return {
|
|
21
|
+
return { healthStatus: "ok", probeUrl };
|
|
22
22
|
}
|
|
23
|
-
return {
|
|
23
|
+
return { healthStatus: "error", probeUrl };
|
|
24
24
|
}
|
|
25
25
|
catch {
|
|
26
|
-
return {
|
|
26
|
+
return { healthStatus: "error", probeUrl };
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
const ADMIN_SESSION_COOKIE_NAME = "admin_session";
|
|
@@ -39,11 +39,11 @@ function findAdminSessionCookieValue(cookieHeader) {
|
|
|
39
39
|
return { kind: "absent" };
|
|
40
40
|
}
|
|
41
41
|
function readCookieHeader(headers) {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
42
|
+
const cookieHeaderValue = headers.get("cookie");
|
|
43
|
+
if (cookieHeaderValue === null) {
|
|
44
44
|
return { kind: "absent" };
|
|
45
45
|
}
|
|
46
|
-
return { kind: "present",
|
|
46
|
+
return { kind: "present", cookieHeaderValue };
|
|
47
47
|
}
|
|
48
48
|
function buildVentureForwardedHeaders(originalHeaders) {
|
|
49
49
|
const forwarded = new Headers(originalHeaders);
|
|
@@ -51,7 +51,7 @@ function buildVentureForwardedHeaders(originalHeaders) {
|
|
|
51
51
|
const cookieLookup = readCookieHeader(forwarded);
|
|
52
52
|
forwarded.delete("cookie");
|
|
53
53
|
if (cookieLookup.kind === "present") {
|
|
54
|
-
const sessionLookup = findAdminSessionCookieValue(cookieLookup.
|
|
54
|
+
const sessionLookup = findAdminSessionCookieValue(cookieLookup.cookieHeaderValue);
|
|
55
55
|
if (sessionLookup.kind === "found") {
|
|
56
56
|
forwarded.set(ADMIN_SESSION_HANDOFF_HEADER, sessionLookup.sessionValue);
|
|
57
57
|
}
|
|
@@ -63,16 +63,15 @@ function stripInboundHandoffHeader(originalHeaders) {
|
|
|
63
63
|
stripped.delete(ADMIN_SESSION_HANDOFF_HEADER);
|
|
64
64
|
return stripped;
|
|
65
65
|
}
|
|
66
|
-
async function forwardToBackend(
|
|
67
|
-
const
|
|
68
|
-
const targetUrl = new URL(forwardInput.targetPath + forwardInput.originalUrl.search, target.baseUrl);
|
|
66
|
+
async function forwardToBackend({ originalRequest, originalUrl, target, targetPath, }) {
|
|
67
|
+
const targetUrl = new URL(targetPath + originalUrl.search, target.baseUrl);
|
|
69
68
|
let forwardedHeaders;
|
|
70
69
|
switch (target.kind) {
|
|
71
70
|
case "venture":
|
|
72
|
-
forwardedHeaders = buildVentureForwardedHeaders(
|
|
71
|
+
forwardedHeaders = buildVentureForwardedHeaders(originalRequest.headers);
|
|
73
72
|
break;
|
|
74
73
|
case "admin":
|
|
75
|
-
forwardedHeaders = stripInboundHandoffHeader(
|
|
74
|
+
forwardedHeaders = stripInboundHandoffHeader(originalRequest.headers);
|
|
76
75
|
break;
|
|
77
76
|
default:
|
|
78
77
|
forwardedHeaders = target;
|
|
@@ -80,9 +79,9 @@ async function forwardToBackend(forwardInput) {
|
|
|
80
79
|
}
|
|
81
80
|
try {
|
|
82
81
|
return await fetch(new Request(targetUrl, {
|
|
83
|
-
method:
|
|
82
|
+
method: originalRequest.method,
|
|
84
83
|
headers: forwardedHeaders,
|
|
85
|
-
body:
|
|
84
|
+
body: originalRequest.body,
|
|
86
85
|
redirect: "manual",
|
|
87
86
|
}));
|
|
88
87
|
}
|
|
@@ -103,23 +102,23 @@ async function forwardToBackend(forwardInput) {
|
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
|
-
function matchPathPrefix(
|
|
107
|
-
if (
|
|
105
|
+
function matchPathPrefix(pathPrefixMatchInput) {
|
|
106
|
+
if (pathPrefixMatchInput.pathname === pathPrefixMatchInput.prefix) {
|
|
108
107
|
return { kind: "match" };
|
|
109
108
|
}
|
|
110
|
-
if (
|
|
109
|
+
if (pathPrefixMatchInput.pathname.startsWith(pathPrefixMatchInput.prefix + "/")) {
|
|
111
110
|
return { kind: "match" };
|
|
112
111
|
}
|
|
113
112
|
return { kind: "no_match" };
|
|
114
113
|
}
|
|
115
|
-
function applyPathRewrite(
|
|
116
|
-
switch (
|
|
114
|
+
function applyPathRewrite(pathRewriteInput) {
|
|
115
|
+
switch (pathRewriteInput.rewrite.kind) {
|
|
117
116
|
case "identity":
|
|
118
|
-
return
|
|
117
|
+
return pathRewriteInput.incomingPath;
|
|
119
118
|
case "transform":
|
|
120
|
-
return
|
|
119
|
+
return pathRewriteInput.rewrite.apply(pathRewriteInput.incomingPath);
|
|
121
120
|
default:
|
|
122
|
-
return
|
|
121
|
+
return pathRewriteInput.rewrite;
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
function matchAllowedHost(matchParams) {
|
|
@@ -146,11 +145,11 @@ function buildHostRejectionResponse(rejectionInput) {
|
|
|
146
145
|
function normalizeBackend(backend) {
|
|
147
146
|
return { kind: backend.kind, baseUrl: stripTrailingSlash(backend.baseUrl) };
|
|
148
147
|
}
|
|
149
|
-
function normalizeRoute(
|
|
148
|
+
function normalizeRoute(proxyRoute) {
|
|
150
149
|
return {
|
|
151
|
-
pathPrefix:
|
|
152
|
-
target: normalizeBackend(
|
|
153
|
-
rewrite:
|
|
150
|
+
pathPrefix: proxyRoute.pathPrefix,
|
|
151
|
+
target: normalizeBackend(proxyRoute.target),
|
|
152
|
+
rewrite: proxyRoute.rewrite,
|
|
154
153
|
};
|
|
155
154
|
}
|
|
156
155
|
function normalizeHealthCheck(healthCheck) {
|
|
@@ -160,7 +159,7 @@ function normalizeHealthCheck(healthCheck) {
|
|
|
160
159
|
case "enabled":
|
|
161
160
|
return {
|
|
162
161
|
kind: "enabled",
|
|
163
|
-
|
|
162
|
+
healthPath: healthCheck.healthPath,
|
|
164
163
|
probeTargets: healthCheck.probeTargets.map(normalizeBackend),
|
|
165
164
|
buildHealthResponse: healthCheck.buildHealthResponse,
|
|
166
165
|
};
|
|
@@ -169,7 +168,7 @@ function normalizeHealthCheck(healthCheck) {
|
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
170
|
/**
|
|
172
|
-
* Build a `
|
|
171
|
+
* Build a `ProxyRoute` that proxies `/auth/*` to the admin backend's `/api/auth/*`
|
|
173
172
|
* surface with cookies preserved. Every frontend that renders admin-shell's
|
|
174
173
|
* login UI needs this route, because admin-shell's `AdminRoute.*` constants
|
|
175
174
|
* (`/auth/login`, `/auth/logout`, `/auth/session`) are the single source of
|
|
@@ -181,7 +180,7 @@ function normalizeHealthCheck(healthCheck) {
|
|
|
181
180
|
*
|
|
182
181
|
* @why Prevents each Worker from hand-writing the admin login rewrite because admin-shell's browser paths and admin-api's server paths intentionally differ.
|
|
183
182
|
* @param adminBaseUrl - Origin of the jakuta-admin API (scheme + host, no path)
|
|
184
|
-
* @returns A
|
|
183
|
+
* @returns A ProxyRoute that matches `/auth` / `/auth/*` and forwards to `adminBaseUrl/api/auth/*`
|
|
185
184
|
*/
|
|
186
185
|
export function createAdminAuthRoute(adminBaseUrl) {
|
|
187
186
|
return {
|
|
@@ -193,11 +192,32 @@ export function createAdminAuthRoute(adminBaseUrl) {
|
|
|
193
192
|
},
|
|
194
193
|
};
|
|
195
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Build a `ProxyRoute` that proxies generated admin-shell `/api/auth/*` requests
|
|
197
|
+
* to the Central Admin backend with cookies preserved.
|
|
198
|
+
*
|
|
199
|
+
* Mount this before the venture `/api/*` route. The generated admin-shell
|
|
200
|
+
* auth client now uses the same `/api/auth/*` route templates as the Central
|
|
201
|
+
* Admin backend, so the worker should forward those paths without rewriting
|
|
202
|
+
* them or applying venture cookie-to-header handoff.
|
|
203
|
+
*
|
|
204
|
+
* @why Preserves generated admin auth paths because venture workers must route
|
|
205
|
+
* Central Admin session requests before the general venture API proxy.
|
|
206
|
+
* @param adminBaseUrl - Origin of the jakuta-admin API (scheme + host, no path)
|
|
207
|
+
* @returns A ProxyRoute that matches `/api/auth` / `/api/auth/*` and forwards to Central Admin unchanged.
|
|
208
|
+
*/
|
|
209
|
+
export function createAdminApiAuthRoute(adminBaseUrl) {
|
|
210
|
+
return {
|
|
211
|
+
pathPrefix: "/api/auth",
|
|
212
|
+
target: { kind: "admin", baseUrl: stripTrailingSlash(adminBaseUrl) },
|
|
213
|
+
rewrite: { kind: "identity" },
|
|
214
|
+
};
|
|
215
|
+
}
|
|
196
216
|
/**
|
|
197
217
|
* Build a `ProxyHandler` from a declarative `ProxyHandlerConfig`. This is the
|
|
198
218
|
* single handler constructor — there is no separate venture or central-admin
|
|
199
219
|
* handler. Consumers express their routing topology as a list of
|
|
200
|
-
* `
|
|
220
|
+
* `ProxyRoute`s pointing at `Backend`s, and the handler dispatches by first-match.
|
|
201
221
|
*
|
|
202
222
|
* Every config must declare its `allowedHosts` — the non-empty list of
|
|
203
223
|
* hostnames this worker accepts. A request for any other hostname is
|
|
@@ -236,7 +256,7 @@ export function createProxyHandler(config) {
|
|
|
236
256
|
}
|
|
237
257
|
const pathname = requestUrl.pathname;
|
|
238
258
|
if (normalizedHealthCheck.kind === "enabled" &&
|
|
239
|
-
pathname === normalizedHealthCheck.
|
|
259
|
+
pathname === normalizedHealthCheck.healthPath) {
|
|
240
260
|
const probeResults = await Promise.all(normalizedHealthCheck.probeTargets.map(async (backend) => {
|
|
241
261
|
const probeResult = await probeHealth(backend.baseUrl);
|
|
242
262
|
return [backend.kind, probeResult];
|
|
@@ -248,17 +268,17 @@ export function createProxyHandler(config) {
|
|
|
248
268
|
const proxiedResponse = normalizedHealthCheck.buildHealthResponse(resultsByKind);
|
|
249
269
|
return { proxied: true, proxiedResponse };
|
|
250
270
|
}
|
|
251
|
-
for (const
|
|
252
|
-
const match = matchPathPrefix({ pathname, prefix:
|
|
271
|
+
for (const proxyRoute of normalizedRoutes) {
|
|
272
|
+
const match = matchPathPrefix({ pathname, prefix: proxyRoute.pathPrefix });
|
|
253
273
|
if (match.kind === "match") {
|
|
254
274
|
const rewrittenPath = applyPathRewrite({
|
|
255
|
-
rewrite:
|
|
275
|
+
rewrite: proxyRoute.rewrite,
|
|
256
276
|
incomingPath: pathname,
|
|
257
277
|
});
|
|
258
278
|
const proxiedResponse = await forwardToBackend({
|
|
259
279
|
originalRequest: workerRequest,
|
|
260
280
|
originalUrl: requestUrl,
|
|
261
|
-
target:
|
|
281
|
+
target: proxyRoute.target,
|
|
262
282
|
targetPath: rewrittenPath,
|
|
263
283
|
});
|
|
264
284
|
return { proxied: true, proxiedResponse };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"same-origin-proxy.js","sourceRoot":"","sources":["../src/same-origin-proxy.ts"],"names":[],"mappings":"AAuJA,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,SAAS,kBAAkB,CAAC,SAAiB;IAC3C,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAOD,SAAS,iBAAiB,CAAC,UAAkC;IAC3D,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACxD,MAAM,EAAE,UAAU,CAAC,UAAU;QAC7B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BACjF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;YAC5C,CAAC;YAED,KAAK,MAAM,UAAU,IAAI,gBAAgB,EAAE,CAAC;gBAC1C,MAAM,KAAK,GAAG,eAAe,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC3E,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBAC3B,MAAM,aAAa,GAAG,gBAAgB,CAAC;wBACrC,OAAO,EAAE,UAAU,CAAC,OAAO;wBAC3B,YAAY,EAAE,QAAQ;qBACvB,CAAC,CAAC;oBACH,MAAM,eAAe,GAAG,MAAM,gBAAgB,CAAC;wBAC7C,eAAe,EAAE,aAAa;wBAC9B,WAAW,EAAE,UAAU;wBACvB,MAAM,EAAE,UAAU,CAAC,MAAM;wBACzB,UAAU,EAAE,aAAa;qBAC1B,CAAC,CAAC;oBACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;gBAC5C,CAAC;YACH,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ProxyRoute } from "./same-origin-proxy.js";
|
|
2
2
|
export declare const VENTURE_API_PREFIX = "/api";
|
|
3
3
|
/**
|
|
4
|
-
* @why
|
|
5
|
-
*
|
|
6
|
-
* Worker-side path contract aligned with the Rust `VENTURE_API_PREFIX`
|
|
7
|
-
* constant.
|
|
4
|
+
* @why Preserves the shared venture API prefix contract because worker proxy
|
|
5
|
+
* routes and Rust venture routing must agree on one mounted path.
|
|
8
6
|
*
|
|
9
7
|
* @param ventureBaseUrl - Origin of the venture backend (scheme + host, no path).
|
|
10
|
-
* @returns A
|
|
8
|
+
* @returns A ProxyRoute that matches `/api` / `/api/*` and forwards to `ventureBaseUrl`.
|
|
11
9
|
*/
|
|
12
|
-
export declare function createVentureApiRoute(ventureBaseUrl: string):
|
|
10
|
+
export declare function createVentureApiRoute(ventureBaseUrl: string): ProxyRoute;
|
|
13
11
|
//# sourceMappingURL=venture_api_route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"venture_api_route.d.ts","sourceRoot":"","sources":["../src/venture_api_route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"venture_api_route.d.ts","sourceRoot":"","sources":["../src/venture_api_route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKzD,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,UAAU,CAMxE"}
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
// and venture Worker proxies all agree on where the admin surface is nested.
|
|
4
4
|
export const VENTURE_API_PREFIX = "/api";
|
|
5
5
|
/**
|
|
6
|
-
* @why
|
|
7
|
-
*
|
|
8
|
-
* Worker-side path contract aligned with the Rust `VENTURE_API_PREFIX`
|
|
9
|
-
* constant.
|
|
6
|
+
* @why Preserves the shared venture API prefix contract because worker proxy
|
|
7
|
+
* routes and Rust venture routing must agree on one mounted path.
|
|
10
8
|
*
|
|
11
9
|
* @param ventureBaseUrl - Origin of the venture backend (scheme + host, no path).
|
|
12
|
-
* @returns A
|
|
10
|
+
* @returns A ProxyRoute that matches `/api` / `/api/*` and forwards to `ventureBaseUrl`.
|
|
13
11
|
*/
|
|
14
12
|
export function createVentureApiRoute(ventureBaseUrl) {
|
|
15
13
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"venture_api_route.js","sourceRoot":"","sources":["../src/venture_api_route.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,2EAA2E;AAC3E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC
|
|
1
|
+
{"version":3,"file":"venture_api_route.js","sourceRoot":"","sources":["../src/venture_api_route.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,2EAA2E;AAC3E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,cAAsB;IACxD,OAAO;QACH,UAAU,EAAE,kBAAkB;QAC9B,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE;QACpD,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;KAChC,CAAC;AACN,CAAC"}
|