Search code examples
javascriptjavacitrix

Citrix retrieve client IP address from web application


Situation

We have:

  • A JSF web application that runs on an Application Server.
  • A Java Server Socket application for smart card access that runs on the client computer.

The web application needs to read a smart card in a smart card reader on the client computer.

For this the web application makes a connection to the Server Socket application on the client computer with the IP address of the client computer.

This IP address is determined through ServletRequest object of our web application call.

Problem

When this setup runs in a RD environment (eg Citrix), we receive the server IP address instead of the client computer IP address.

Question

How can we retrieve the client IP address? Perhaps by using WebSockets?


Comment

I am not sure if these are correct, but I have looked around and some possible solutions found are:

  • using a Virtual IP Policy (I understand that this would make the localhost call revert to the correct IP address?)
  • Adding a X-Forwarded-For header to the request

These would require modification/configuration of the RD environment and we don't manage this level. Of course, if there is no other way, I can try to request this.


Solution

  • You should try X-Forwarded-For. Worked for us. Somehow different scenario but it worked for us.