Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

Fail-close production HTTP ingress with explicit gate regression tests: src/proxy.ts

davoodmehraban89 committed Oct 21, 2026 at 08:45 UTC e598dddec38bbfcb23628df1701842fe6dba319a
1 file changed +24
src/proxy.ts new
+24
@@ -0,0 +1,24 @@
1 +import {NextRequest, NextResponse} from 'next/server';
2 +import {isProductionOperationBlocked} from './platform/identity/production-http-guard';
3 +
4 +/**
5 + * Production requests must not reach tenant data, server actions, or
6 + * operational routes until external identity and infrastructure are provisioned.
7 + * No client-supplied header can bypass this gate.
8 + */
9 +export function proxy(request:NextRequest){
10 + if(!isProductionOperationBlocked(process.env,request.nextUrl.pathname))return NextResponse.next();
11 + return new NextResponse('دسترسی عملیاتی مسدود است',{
12 + status:403,
13 + headers:{
14 + 'Content-Type':'text/plain; charset=utf-8',
15 + 'Cache-Control':'no-store',
16 + 'X-Content-Type-Options':'nosniff',
17 + 'X-Frame-Options':'DENY'
18 + }
19 + });
20 +}
21 +
22 +export const config={
23 + matcher:['/((?!_next/static|_next/image|favicon.ico).*)']
24 +};