From 954354b89a1d88015a644a2f797c841b1f88ea6f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:21:31 +0000 Subject: [PATCH] Preview the storefront from / on a localhost-bound next dev (saas-parallel-baselining PB4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The live preview (#5) opened /dk because `/` failed behind orun.work's preview gateway. The middleware rewrites `/` to the default region, and under `next dev -H 127.0.0.1` Next gives the middleware a `localhost` URL, treats the rewrite as external and proxies it to itself, over TLS once the gateway's `x-forwarded-proto: https` arrives ("Failed to proxy … EPROTO"). - apps/web/component.yaml: spec.preview runs `next dev -H localhost -p 8000`, with `--dns-result-order=ipv4first` in NODE_OPTIONS so `localhost` stays on 127.0.0.1 (it listens on tcp4 127.0.0.1:8000 only; [::1]:8000 refuses), and the tab opens / again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019PcpNV6SjymJBPv3nNkC4z --- apps/web/component.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/web/component.yaml b/apps/web/component.yaml index 303075d..11488c8 100644 --- a/apps/web/component.yaml +++ b/apps/web/component.yaml @@ -68,18 +68,20 @@ spec: # storefront's own port, with its heap capped: the box is shared with the # agent. No Medusa backend is named (NEXT_PUBLIC_MEDUSA_BACKEND_URL and its # publishable key are Orun secrets the build reads), so it runs in sample - # mode, on its sample catalogue. The tab opens /dk, the default region's - # home: `/` is the middleware's rewrite to it, which `next dev` turns into a - # request to itself over https behind the preview (it fails). + # mode, on its sample catalogue. It binds `localhost`, not 127.0.0.1: the + # middleware rewrites `/` to the default region, and with a numeric host + # `next dev` gives the middleware a `localhost` URL, sees every rewrite as + # external and proxies it to itself (over https behind the preview, where + # it fails). `--dns-result-order=ipv4first` keeps `localhost` on 127.0.0.1. preview: run: - sh - -c - - pnpm install --frozen-lockfile --prefer-offline --filter "@app/web..." && exec node_modules/.bin/next dev -H 127.0.0.1 -p 8000 + - pnpm install --frozen-lockfile --prefer-offline --filter "@app/web..." && exec node_modules/.bin/next dev -H localhost -p 8000 port: 8000 - path: /dk + path: / env: - NODE_OPTIONS: --max-old-space-size=1024 + NODE_OPTIONS: --max-old-space-size=1024 --dns-result-order=ipv4first NEXT_TELEMETRY_DISABLED: "1" parameters: nodeVersion: "22"