fix(olcum): Tencent/Huawei bulut botları sunucuda 403 ile kesiliyor, Rybbit betiği otomasyon tarayıcısında yüklenmiyor
All checks were successful
Deploy / deploy (push) Successful in 13m23s
All checks were successful
Deploy / deploy (push) Successful in 13m23s
Ekim'de Rybbit oturumlarının üçte ikisi Singapur/Çin veri merkezlerinden gelen headless Chrome'du. src/proxy.ts, x-forwarded-for'un son öğesini src/lib/engellenen-araliklar.ts'teki RDAP ile doğrulanmış CIDR listesiyle karşılaştırıp sayfa render edilmeden 403 döner. Rybbit betiği navigator.webdriver açıkken yüklenmez; giriş linki nofollow. Ayrıntı ve kanıt docs/ekip-raporlari/2026-10-16/. Sürüm artmadı: kullanıcıya görünmez. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
27
src/proxy.ts
Normal file
27
src/proxy.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { NextResponse, type NextRequest } from "next/server";
|
||||
import { ipEngelliMi, istemciIp } from "@/lib/engellenen-araliklar";
|
||||
|
||||
/**
|
||||
* Her isteğin önünde çalışır (Next "proxy" dosya konvansiyonu; eski adı
|
||||
* middleware). Tek işi var: bulut sunucularından gelen bot taramasını
|
||||
* (Tencent/Huawei aralıkları, bkz. `src/lib/engellenen-araliklar.ts`) sayfa
|
||||
* render edilmeden 403 ile kesmek. Böylece bot ne Rybbit'e oturum yazar ne
|
||||
* de SQLite'ı ve V8 heap'ini boşa yorar.
|
||||
*
|
||||
* Kapsam dışı: `_next/static` ve `_next/image` (sayfa 403 alınca tarayıcı
|
||||
* bunları zaten istemez; gerçek kullanıcının varlık isteklerine ek maliyet
|
||||
* binmesin) ve `/api/saglik` (konteyner içi sağlık kontrolü, XFF başlığı yok).
|
||||
*/
|
||||
export function proxy(request: NextRequest) {
|
||||
if (ipEngelliMi(istemciIp(request.headers))) {
|
||||
return new NextResponse("Erişim engellendi.", {
|
||||
status: 403,
|
||||
headers: { "content-type": "text/plain; charset=utf-8" },
|
||||
});
|
||||
}
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!_next/static|_next/image|api/saglik).*)"],
|
||||
};
|
||||
Reference in New Issue
Block a user