From b83be7be53874564db4c6769b138e7d12a91da29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20=C5=BBydek?= Date: Mon, 17 Jun 2024 15:27:21 +0200 Subject: [PATCH] chore: use x-azure-socketip instead --- proxy/utils/headers.test.ts | 2 +- proxy/utils/headers.ts | 3 +-- shared/test/azure.ts | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/proxy/utils/headers.test.ts b/proxy/utils/headers.test.ts index b94367b..edea2a2 100644 --- a/proxy/utils/headers.test.ts +++ b/proxy/utils/headers.test.ts @@ -28,7 +28,7 @@ const mockReq = { 'x-azure-requestchain': 'hops=1', 'x-azure-socketip': '46.204.4.119', 'x-forwarded-for': '127.0.0.1:12345', - 'x-azure-clientip': '127.0.0.1:12345', + 'x-azure-socketip': '127.0.0.1:12345', 'x-forwarded-host': 'fpjs.sh', }, user: null, diff --git a/proxy/utils/headers.ts b/proxy/utils/headers.ts index b7169f5..8669250 100644 --- a/proxy/utils/headers.ts +++ b/proxy/utils/headers.ts @@ -71,8 +71,7 @@ export function updateResponseHeaders( } function resolveClientIp(request: HttpRequest, logger?: Logger) { - const clientIp = - request.headers['x-azure-clientip'] || request.headers['x-client-ip'] || request.headers['x-real-ip'] || '' + const clientIp = request.headers['ip'] || request.headers['x-client-ip'] || request.headers['x-real-ip'] || '' logger?.verbose('Client IP resolved', { clientIp, diff --git a/shared/test/azure.ts b/shared/test/azure.ts index 6af6bcb..74bdcc3 100644 --- a/shared/test/azure.ts +++ b/shared/test/azure.ts @@ -40,7 +40,7 @@ export const mockRequestGet = (url: string, uri: string, query: HttpRequestQuery 'x-azure-socketip': '46.204.4.119', 'x-forwarded-for': '127.0.0.1', 'x-client-ip': '128.0.0.1', - 'x-azure-clientip': '127.0.0.1', + 'x-azure-socketip': '127.0.0.1', }, query, params: { @@ -69,7 +69,7 @@ export const mockRequestPost = (url: string, uri: string) => { 'x-azure-socketip': '46.204.4.119', 'x-forwarded-for': '127.0.0.1', 'x-client-ip': '128.0.0.1', - 'x-azure-clientip': '127.0.0.1', + 'x-azure-socketip': '127.0.0.1', }, query: {}, params: {