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

Actual ClientIP (RemoteAddr) #137

Closed
barneykim opened this issue Jan 23, 2015 · 1 comment
Closed

Actual ClientIP (RemoteAddr) #137

barneykim opened this issue Jan 23, 2015 · 1 comment

Comments

@barneykim
Copy link
Contributor

As you already know, If you are using a proxy server or the L7 equipment, the ClientIP(RemoteAddr) is the IP address of the Proxy or L7 equipment.
In this case, you must use the x-forwarded-for in the HTTP header.

61 line of StandardHostValveInvokeInterceptor are following:

final String remoteAddr = request.getRemoteAddr();
trace.recordRemoteAddress(remoteAddr);

I want change, as shown below.

final String remoteAddr = getRemoteAddr(request);
...
private String getRemoteAddr(HttpServletRequest request) {
    String remoteAddr = request.getHeader("x-forwarded-for");
    if (StringUtils.isBlank(remoteAddr)) {
        remoteAddr = request.getRemoteAddr();
    } else {
        remoteAddr = remoteAddr.split(",")[0].trim();
    }
   return remoteAddr;
}
@emeroad
Copy link
Member

emeroad commented Jan 23, 2015

Good suggestion.
Will be included in next version(1.0.5-SNAPSHOT).

emeroad added a commit to emeroad/pinpoint that referenced this issue Jan 23, 2015
emeroad added a commit to emeroad/pinpoint that referenced this issue Jan 23, 2015
@nstopkimsk nstopkimsk added this to the 1.0.5 milestone Apr 15, 2015
@nstopkimsk nstopkimsk modified the milestones: 1.1.0, 1.0.5, 1.5.0 Jun 1, 2015
emeroad added a commit to emeroad/pinpoint that referenced this issue Aug 26, 2015
@emeroad emeroad modified the milestones: 1.1.0, 1.5.0, 1.1.1 Aug 26, 2015
emeroad added a commit that referenced this issue Aug 26, 2015
@emeroad emeroad closed this as completed Sep 9, 2015
emeroad added a commit that referenced this issue Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants