[ 
https://issues.apache.org/jira/browse/ATLAS-3387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915517#comment-16915517
 ] 

Ramesh Mani commented on ATLAS-3387:
------------------------------------

[~nikhilbonte]

X-FORWARDED-FOR is a list of ips, that contains all the hops the call made, 
please consider doing this.

String ret = httpServletRequest.getHeader("X-FORWARDED-FOR");

if (StringUtils.isNotBlank(ret)) {

     String[] forwardedAddresses = ret(",");

     if (ipAddress.length > 0) {

        ret = forwardedAddresses[0].trim();

     }

}

if (ret == null) {

try { 

     InetAddress inetAddr = 
InetAddress.getByName(httpServletRequest.getRemoteAddr()); 

     ret = inetAddr.getHostAddress(); 

} catch (UnknownHostException ex) {

 LOG.error("Failed to retrieve client IP address", ex);

 }

return ret;

 

> Consider X-FORWARDED-FOR header for getting end user IP address when 
> connected with proxy
> -----------------------------------------------------------------------------------------
>
>                 Key: ATLAS-3387
>                 URL: https://issues.apache.org/jira/browse/ATLAS-3387
>             Project: Atlas
>          Issue Type: Bug
>          Components: atlas-webui
>            Reporter: Nikhil Bonte
>            Assignee: Nikhil Bonte
>            Priority: Major
>         Attachments: 
> ATLAS-3387-Consider-X-FORWARDED-FOR-header-for-getti.patch
>
>
> Consider X-FORWARDED-FOR header for getting end user IP address when 
> connected with proxy



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to