From 1a23f724c74b2747a565c22b4ec0defaf9df2b29 Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Thu, 24 Oct 2024 09:16:40 +0200 Subject: [PATCH] Trap for cdn abusers with a specific map/app version Signed-off-by: Alexander Borsuk --- src/servers.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/servers.ts b/src/servers.ts index 5319c84..ac8b104 100644 --- a/src/servers.ts +++ b/src/servers.ts @@ -122,6 +122,11 @@ export async function getServersList(request: Request) { if (dataVersion === null) { // Older clients download from the archive. servers = [SERVER.backblaze]; + } else if (dataVersion == 240702 && request.headers.get('x-om-appversion') == '1.8.6-4-ios') { + // Redirect unknown bad guys who uses our servers to a slow download "trap" node. + return new Response('["https://cdn-fi2.organicmaps.app/"]', { + headers: { 'Content-Type': 'application/json' }, + }); } else { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore workarounds error TS2339: Property 'continent' does not exist on type 'IncomingRequestCfProperties'.