Skip to content

Commit

Permalink
chore: use x-azure-socketip instead
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUnderScorer committed Jun 17, 2024
1 parent cfdec37 commit b83be7b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion proxy/utils/headers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions proxy/utils/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions shared/test/azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit b83be7b

Please sign in to comment.