diff --git a/esm/package-lock.json b/esm/package-lock.json index 56a615a..67ca5af 100644 --- a/esm/package-lock.json +++ b/esm/package-lock.json @@ -1,6 +1,6 @@ { "name": "moesif-cloudflare", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/esm/package.json b/esm/package.json index a700fe2..c7b4916 100644 --- a/esm/package.json +++ b/esm/package.json @@ -1,6 +1,6 @@ { "name": "moesif-cloudflare", - "version": "2.0.0", + "version": "2.0.1", "description": "Moesif API analytics and monetization integration for Cloudflare workers", "main": "src/index.mjs", "keywords": [ diff --git a/esm/src/batcher.mjs b/esm/src/batcher.mjs index c620fcb..b93152c 100644 --- a/esm/src/batcher.mjs +++ b/esm/src/batcher.mjs @@ -114,7 +114,7 @@ class Batcher { const moesifHeaders = { Accept: 'application/json; charset=utf-8', 'X-Moesif-Application-Id': appId, - 'User-Agent': 'moesif-cloudflare/2.0.0', + 'User-Agent': 'moesif-cloudflare/2.0.1', 'X-Moesif-Cf-Install-Id': INSTALL_ID, 'X-Moesif-Cf-Install-Product': INSTALL_PRODUCT && INSTALL_PRODUCT.id, 'X-Moesif-Cf-Install-Type': 'esm', diff --git a/esm/src/index.mjs b/esm/src/index.mjs index 0606e7e..e717c3d 100644 --- a/esm/src/index.mjs +++ b/esm/src/index.mjs @@ -85,7 +85,7 @@ function moesifMiddleware(originalFetch, userOptions) { uri: request.url, verb: request.method, headers: headersToObject(request.headers), - ip_address: request.headers.get('cf-connecting-ip'), + ip_address: request.headers.get('x-forwarded-for') || request.headers.get('cf-connecting-ip'), }, response: response.isEmpty ? undefined diff --git a/legacy/src/index.js b/legacy/src/index.js index d0c76c0..c544d3b 100644 --- a/legacy/src/index.js +++ b/legacy/src/index.js @@ -341,7 +341,7 @@ async function makeMoesifEvent(request, response, before, after, txId, requestBo uri: request.url, verb: request.method, headers: headersToObject(request.headers), - ip_address: request.headers.get('cf-connecting-ip') + ip_address: request.headers.get('x-forwarded-for') || request.headers.get('cf-connecting-ip') }, response: response.isEmpty ? undefined : { time: after,