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:
caty21
2026-06-27 16:27:20 +02:00
co-authored by Claude Sonnet 4.6
parent 5cf5d76601
commit 67c1811c8f
2 changed files with 16 additions and 5 deletions
+4 -1
View File
@@ -3,6 +3,7 @@ import { fetchAllCBPaths } from "@/lib/rateprobability";
import type { RateProbData } from "@/lib/rateprobability";
export const dynamic = "force-dynamic";
export const preferredRegion = ["fra1", "lhr1", "cdg1"]; // Europe (Frankfurt / London / Paris)
export type { RateProbData, CBRatePath, RateProbMeeting } from "@/lib/rateprobability";
@@ -13,8 +14,10 @@ export interface RateProbabilitiesResponse {
export async function GET() {
const data = await fetchAllCBPaths();
const currencies = Object.keys(data);
console.log(`[rate-prob] fetched ${currencies.length} CBs: ${currencies.join(", ")}`);
return NextResponse.json(
{ data, fetchedAt: new Date().toISOString() } satisfies RateProbabilitiesResponse,
{ headers: { "Cache-Control": "s-maxage=3600, stale-while-revalidate=7200" } }
{ headers: { "Cache-Control": "no-store" } }
);
}