Skip to content

Commit

Permalink
Use ip address from x forwarded for (#26)
Browse files Browse the repository at this point in the history
* update ip address.

* bump version.
  • Loading branch information
xinghengwang authored Oct 30, 2024
1 parent 11ba990 commit b5e26bb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion esm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion esm/package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion esm/src/batcher.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion esm/src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion legacy/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b5e26bb

Please sign in to comment.