veryfront 0.1.52 → 0.1.53

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -114,7 +114,8 @@ function handleWebSocketUpgrade(req) {
114
114
  const scope = parsed.environment === "preview" ? "preview" : "production";
115
115
  const projectSlug = parsed.slug || undefined;
116
116
  const serverWsUrl = PRODUCTION_SERVER_URL.replace(/^http/, "ws");
117
- const targetUrl = new URL(`${serverWsUrl}${url.pathname}${url.search}`);
117
+ const safePath = url.pathname.replace(/^\/\/+/, "/");
118
+ const targetUrl = new URL(`${serverWsUrl}${safePath}${url.search}`);
118
119
  targetUrl.searchParams.set("x-project-slug", projectSlug || "");
119
120
  targetUrl.searchParams.set("x-environment", scope);
120
121
  proxyLogger.info("[WebSocket] Upgrade request received", {
@@ -310,7 +311,9 @@ function forwardToServer(req) {
310
311
  const baseUrl = dedicatedServerUrl ??
311
312
  rendererRouter?.resolve(ctx.projectSlug) ??
312
313
  PRODUCTION_SERVER_URL;
313
- const serverUrl = new URL(url.pathname + url.search, baseUrl);
314
+ // Collapse leading slashes to prevent protocol-relative URL interpretation (e.g. "//cms/..." hostname "cms")
315
+ const safePath = url.pathname.replace(/^\/\/+/, "/");
316
+ const serverUrl = new URL(safePath + url.search, baseUrl);
314
317
  // Delay before retry (not on first attempt)
315
318
  if (attempt > 0) {
316
319
  proxyLogger.info(`[Retry] Attempt ${attempt + 1}/${maxRetries + 1} after ${VERYFRONT_SERVER_RETRY_DELAY_MS}ms`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -151,7 +151,8 @@ function handleWebSocketUpgrade(req: dntShim.Request): dntShim.Response {
151
151
  const projectSlug = parsed.slug || undefined;
152
152
 
153
153
  const serverWsUrl = PRODUCTION_SERVER_URL.replace(/^http/, "ws");
154
- const targetUrl = new URL(`${serverWsUrl}${url.pathname}${url.search}`);
154
+ const safePath = url.pathname.replace(/^\/\/+/, "/");
155
+ const targetUrl = new URL(`${serverWsUrl}${safePath}${url.search}`);
155
156
  targetUrl.searchParams.set("x-project-slug", projectSlug || "");
156
157
  targetUrl.searchParams.set("x-environment", scope);
157
158
 
@@ -367,7 +368,9 @@ function forwardToServer(req: dntShim.Request): Promise<dntShim.Response> {
367
368
  const baseUrl = dedicatedServerUrl ??
368
369
  rendererRouter?.resolve(ctx.projectSlug) ??
369
370
  PRODUCTION_SERVER_URL;
370
- const serverUrl = new URL(url.pathname + url.search, baseUrl);
371
+ // Collapse leading slashes to prevent protocol-relative URL interpretation (e.g. "//cms/..." hostname "cms")
372
+ const safePath = url.pathname.replace(/^\/\/+/, "/");
373
+ const serverUrl = new URL(safePath + url.search, baseUrl);
371
374
  // Delay before retry (not on first attempt)
372
375
  if (attempt > 0) {
373
376
  proxyLogger.info(