cancel
Showing results for 
Search instead for 
Did you mean: 

Getting client IP-address (working with Web Dispatcher !)

Former Member
0 Kudos

Hi all,

hopefully someone can help me here. Getting the client's IP-address from the http-request has been discussed here, however I have one specialty:

We are working with the SAP Web Dispatcher.!

Doing this the "request->get_header_field( '~remote_addr' )." returns always the IP-address of the Web-Dispatcher!

Anyone knows if there is a way to get the ip-address of the real "client" ??

Thanks in advance

Stefan Hester

Question was accidentally posted twice. Has been solved!

Message was edited by: Stefan Hester

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

I have exactly tghe same issue and i bvere found the soltion.

Any tips forme ?

Thanks a have a ncie day.

Laurent

Former Member
0 Kudos

Hi,

if anyone else is looking for a solution: Please add

 AppendHeader xforwardedfor %{REMOTE_ADDR} 

to your webdisp action file.

On the ABAP side you can access this field with

request->get_header_field('xforwardedfor')

On the java side you can access the client address with

IPortalComponentRequest request;
String clientAddress = request.getServletRequest().getHeader("xforwardedfor");
if (clientAddress == null || clientAddress.equals("")) 
{
    //direct connection
    clientAddress = request.getServletRequest().getRemoteAddr();
}
 

Older version of webdisp where using a profile parameter: wdisp/add_xforwardedfor_header

(https://cw.sdn.sap.com/cw/docs/DOC-107640)

Best Regards,

Inga Andreasson