mirror of
https://github.com/Such-Software/xmrcheckout.git
synced 2026-12-02 12:24:17 +01:00
fix(nginx): refuse the admin API at the public edge
nginx proxied all of /api/ to the internet, including /api/admin, which returns every merchant's API key and webhook secret behind a single shared key. The only caller is the admin panel's server actions, so nginx now answers /api/admin with a 404 and those actions reach the API directly over the compose network through ADMIN_API_BASE_URL (default http://api:8000), falling back to API_BASE_URL for non-Docker installs.
This commit is contained in:
@@ -4,7 +4,10 @@ import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
const apiBaseUrl = process.env.API_BASE_URL ?? "http://localhost:8000";
|
||||
// The public nginx edge refuses /api/admin, so admin calls go straight to the
|
||||
// API service. Compose sets ADMIN_API_BASE_URL to http://api:8000.
|
||||
const apiBaseUrl =
|
||||
process.env.ADMIN_API_BASE_URL ?? process.env.API_BASE_URL ?? "http://localhost:8000";
|
||||
|
||||
const ADMIN_COOKIE = "xmrcheckout_admin_key";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user