fix(demo): POST waitlist to canonical www host to avoid preflight redirect
The demo (demo.pcbjam.com) cross-posts the waitlist to the marketing site's
serverless endpoint. It targeted the apex pcbjam.com, which 308-redirects to
www on Vercel; a CORS preflight can't follow redirects, so the OPTIONS failed
("Redirect is not allowed for a preflight request") and the POST never landed.
Point the waitlist target at the canonical www host. www.pcbjam.com already
returns 204 with access-control-allow-origin: https://demo.pcbjam.com, so the
preflight passes. Landing/version-badge link stays on the apex.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01REwWZGkAz1AZUJw8yqxkCN
This commit is contained in:
parent
e86be160a6
commit
34d2602132
3 changed files with 15 additions and 4 deletions
|
|
@ -58,7 +58,14 @@ function parseArgs(argv) {
|
|||
a.cdn = a.cdn.replace(/\/+$/, "");
|
||||
a.repo = a.repo.replace(/\/+$/, "");
|
||||
a.landing = a.landing.replace(/\/+$/, "");
|
||||
a.waitlist = a.waitlist || `${a.landing}/api/waitlist`;
|
||||
// The cross-origin demo POSTs the waitlist to the marketing site's serverless
|
||||
// endpoint. The apex (pcbjam.com) 308-redirects to www on Vercel, and a CORS
|
||||
// preflight can't follow redirects, so the demo must hit the canonical www host
|
||||
// directly. Derive from --landing for custom/staging hosts, but pin the
|
||||
// production apex to www. (Landing/version-badge link stays on the apex.)
|
||||
const waitlistHost =
|
||||
a.landing === "https://pcbjam.com" ? "https://www.pcbjam.com" : a.landing;
|
||||
a.waitlist = a.waitlist || `${waitlistHost}/api/waitlist`;
|
||||
return a;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue