mirror of
https://github.com/RomySaputraSihananda/ares.git
synced 2026-08-26 09:08:15 +00:00
fix(web): send X-API-Key header to MT5 bridge for Cloudflare WAF bypass
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
9716fc0955
commit
5bf0386cd4
+6
-2
@@ -1,9 +1,13 @@
|
|||||||
// Server-side only — bridge URL never leaves this file
|
// Server-side only — bridge URL never leaves this file
|
||||||
|
|
||||||
async function apiFetch<T>(path: string): Promise<T> {
|
async function apiFetch<T>(path: string): Promise<T> {
|
||||||
const base = process.env.MT5_BASE_URL ?? "http://localhost:8000";
|
const base = process.env.MT5_BASE_URL ?? "http://localhost:8000";
|
||||||
|
const apiKey = process.env.MT5_API_KEY;
|
||||||
|
const headers: Record<string, string> = {};
|
||||||
|
if (apiKey) headers["X-API-Key"] = apiKey;
|
||||||
const res = await fetch(`${base}${path}`, {
|
const res = await fetch(`${base}${path}`, {
|
||||||
next: { revalidate: 0 }, // always fresh
|
headers,
|
||||||
|
next: { revalidate: 0 },
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error(`MT5 bridge ${path} → ${res.status}`);
|
if (!res.ok) throw new Error(`MT5 bridge ${path} → ${res.status}`);
|
||||||
return res.json();
|
return res.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user