mirror of
https://github.com/multica-ai/multica.git
synced 2026-06-17 03:38:32 +02:00
fix(landing): call API origin directly from Contact Sales form (#3054)
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 <github@multica.ai>
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user