cancel
Showing results for 
Search instead for 
Did you mean: 

IP address issue when deployed in SAP HCP

0 Kudos

Hello everyone,

I have a JAVA Servlet project developed using Tomcat 7.

My projects logic is that whenever a request comes from certain IP it responds to the same IP with a new instance of browser as an response.

When I run and test this application locally it works perfect and by the way my local working IP address will be something like this 10.52.xxx.xxx. So request has 10.52.xxx.xxx and response is given to 10.52.xxx.xxx and all happies

Now things looks perfect and I planned to deploy this project in a Server which has an IP addess of 172.32.xxx.xxx and I have completed deployment of the same.

Now the issue which I am facing is that when I try to make a request to the project in the server (172.32.xxx.xxx) from my network (10.52.xxx.xxx).

In my project I have code like

  

    String ip = request.getRemoteAddr(); //gets request IP address to give a new instance of browser

Now the variable **ip** contains an IP address of 172.32.xxx.xxx. So my code will try to give a browser instance to 172.32.xxx.xxx which doesn't exist. It should ideally give the browser instance back to 10.52.xxx.xxx as this is from which it had received the request so it has to respond to this IP.

I know both Server and the client request are in different network but I would like to know all possible solutions to fix the same so that browser is given back to 10.52.xxx.xxx.

Any help highly appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member183029
Participant
0 Kudos

Try to see if your desired result is there in XFF header.

String ipAddress = request.getHeader("X-FORWARDED-FOR");