Default API_BASE_URL and PROD_ORIGIN to the test environment

Previously API_BASE_URL defaulted to http://localhost:8080/api, which
only works inside the dev server proxy. For standalone/SSR runs without
the proxy, the default now points to https://flights.test.aeroflot.ru.

Dev continues to use the same-origin proxy because scripts/dev-server.mjs
explicitly injects API_BASE_URL=http://localhost:8080/api into the
Modern.js child process env, keeping browser fetches CORS/WAF safe.
This commit is contained in:
2026-04-17 15:31:03 +03:00
parent 896e6bd83d
commit e20ef940f8
3 changed files with 23 additions and 8 deletions
+14 -2
View File
@@ -25,11 +25,23 @@ const modernBin = resolve("node_modules", ".bin", "modern");
const modernProcess = existsSync(modernBin)
? spawn(modernBin, ["dev"], {
stdio: "inherit",
env: { ...process.env, PORT: String(MODERNJS_PORT) },
env: {
...process.env,
PORT: String(MODERNJS_PORT),
// Point the browser bundle at the same-origin proxy so CORS/WAF stay
// bypassed. The proxy (this file) forwards to API_TARGET via curl.
API_BASE_URL: process.env.API_BASE_URL ?? "http://localhost:8080/api",
},
})
: spawn(process.execPath, [resolve("node_modules", "@modern-js/app-tools", "bin", "modern.js"), "dev"], {
stdio: "inherit",
env: { ...process.env, PORT: String(MODERNJS_PORT) },
env: {
...process.env,
PORT: String(MODERNJS_PORT),
// Point the browser bundle at the same-origin proxy so CORS/WAF stay
// bypassed. The proxy (this file) forwards to API_TARGET via curl.
API_BASE_URL: process.env.API_BASE_URL ?? "http://localhost:8080/api",
},
});
modernProcess.on("error", (err) => {
console.error("Modern.js failed:", err);