mirror of
https://github.com/caty21/forex-dashboard.git
synced 2026-07-27 20:37:45 +00:00
fix: rate-probabilities → European region + stronger browser headers
- preferredRegion: fra1/lhr1/cdg1 to bypass US cloud IP blocks on rateprobability.com - Better sec-* headers to pass bot detection (same-origin cors mode) - cache: no-store on fetch to avoid stale null caching - Log CB count on each invocation for diagnostics Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+12
-4
@@ -100,11 +100,19 @@ async function fetchCBPath(ccy: Currency, slug: string): Promise<CBRatePath | nu
|
||||
try {
|
||||
const res = await fetch(`https://rateprobability.com/api/${slug}/latest`, {
|
||||
headers: {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124.0.0.0 Safari/537.36",
|
||||
"Referer": `https://rateprobability.com/${slug}`,
|
||||
"Accept": "application/json, */*",
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
|
||||
"Referer": `https://rateprobability.com/${slug}`,
|
||||
"Origin": "https://rateprobability.com",
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"sec-ch-ua": '"Chromium";v="125", "Not.A/Brand";v="24"',
|
||||
"sec-ch-ua-mobile":"?0",
|
||||
"sec-fetch-dest": "empty",
|
||||
"sec-fetch-mode": "cors",
|
||||
"sec-fetch-site": "same-origin",
|
||||
},
|
||||
next: { revalidate: 3600 },
|
||||
cache: "no-store",
|
||||
});
|
||||
if (!res.ok) return null;
|
||||
const body = await res.json() as Record<string, unknown>;
|
||||
|
||||
Reference in New Issue
Block a user