javajvx

Client property "client.remoteaddr" contains multiple addresses


I have a JVx application with react UI and use following code on server-side:

SessionContext.getCurrentSession().getProperty(
          IConnectionConstants.PREFIX_CLIENT + IRequest.PROP_REMOTE_ADDRESS)

The result is one IP address e.g. 10.0.0.1 in my office network and also at home. The same command returns multiple addresses in my customers environment, e.g. 11.0.0.1, 12.0.0.3

What's the difference and why are there more than one IP addresses in my customers network? Which IP is the remote right host IP?


Solution

  • In servlet environments like flutter UI or react UI, it's what the servlet API defines. The JVx server-side has no specific code and it's not possible to access the client directly from server-side.

    The browser or the mobile client communicates via https to a servlet and the servlet reads the remote address from the request. A standard API call.

    It's possible that the communication layer or a proxy adds additional information like described in this question. JVx doesn't read the X-Forwarded-For property.

    Simply ask your customer about network details. If one host is a proxy or load-balancer, you should know what's going on.