From bc056cf0eaff917f10be5a3d33eddc08e4d8cc43 Mon Sep 17 00:00:00 2001 From: Bohan Jiang <52446949+Bohan-J@users.noreply.github.com> Date: Fri, 22 May 2026 13:50:47 +0800 Subject: [PATCH] fix(landing): call API origin directly from Contact Sales form (#3054) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The form posted to a relative `/api/contact-sales`, which on the Vercel-hosted web app gets handled by the `/api/*` rewrite using the server-only `REMOTE_API_URL`. On `multica-app.copilothub.ai` that env points at a privately-resolvable host, so the rewrite returns 404 (`DNS_HOSTNAME_RESOLVED_PRIVATE`) even though every other API call works — the rest of the app uses `NEXT_PUBLIC_API_URL` and hits the API origin directly. Switch the form to do the same: `${NEXT_PUBLIC_API_URL}/api/contact-sales`, falling back to a relative URL for local dev / self-hosted setups where same-origin still works. MUL-2493 Co-authored-by: multica-agent --- .../landing/components/contact-sales-page-client.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/web/features/landing/components/contact-sales-page-client.tsx b/apps/web/features/landing/components/contact-sales-page-client.tsx index 0f0040345..f67c54a69 100644 --- a/apps/web/features/landing/components/contact-sales-page-client.tsx +++ b/apps/web/features/landing/components/contact-sales-page-client.tsx @@ -89,7 +89,13 @@ export function ContactSalesPageClient() { setState({ status: "submitting" }); try { - const res = await fetch("/api/contact-sales", { + // Call the API origin directly (same as the rest of the web app via + // `apiBaseUrl={process.env.NEXT_PUBLIC_API_URL}`). The `/api/*` Vercel + // rewrite uses server-only `REMOTE_API_URL`, which on Vercel may not + // be publicly resolvable — relying on it makes this endpoint 404 even + // when every other API works. + const apiBase = process.env.NEXT_PUBLIC_API_URL ?? ""; + const res = await fetch(`${apiBase}/api/contact-sales`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({