Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 14, 2008 at 01:38 PM

    Hello,

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

    Any tips forme ?

    Thanks a have a ncie day.

    Laurent

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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