Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support record client source ip #64

Closed
wants to merge 1 commit into from

Conversation

@menggong
Copy link

menggong commented May 11, 2020

Checklist
  • npm test passes
  • commit message follows commit guidelines
Affected core subsystem(s)

logger

Description of change

支持识别通过HTTP代理或负载均衡方式请求头中的真实用户IP。

@codecov
Copy link

codecov bot commented May 11, 2020

Codecov Report

Merging #64 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #64   +/-   ##
=======================================
  Coverage   99.45%   99.45%           
=======================================
  Files          14       14           
  Lines         370      370           
=======================================
  Hits          368      368           
  Misses          2        2           
Impacted Files Coverage Δ
lib/egg/context_logger.js 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a539ffe...647bd79. Read the comment docs.

@@ -25,7 +25,7 @@ class ContextLogger {
const use = ctx.starttime ? Date.now() - ctx.starttime : 0;
return '[' +
userId + '/' +
ctx.ip + '/' +
(ctx.request.header['x-forwarded-for'] || ctx.ip) + '/' +

This comment has been minimized.

@atian25

atian25 May 14, 2020

Member

ctx.ip has deal this

@atian25 atian25 closed this May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.