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: {