Skip to content

GetRemoteAddress()

ts
GetRemoteAddress(): string;

Returns the remote (client) IP address. In a reverse-proxied environment, Syncplify Server! will make a best effort to return the actual client IP address. If this is not possible, the IP address of the reverse proxy will be returned instead.

NOTE

The returned address may be either IPv4 or IPv6, depending on your network and operating system configuration.

IMPORTANT

If Syncplify Server! is running behind a firewall, reverse proxy, or load balancer, it is the responsibility of that device to ensure the actual client IP address is made available to Syncplify Server! in the IP packets. This can be achieved in two main ways:

  1. Transparent mode: The firewall, reverse proxy, or load balancer forwards the original IP packets to Syncplify Server! without altering the source IP address.
  2. HAProxy protocol: The reverse proxy or load balancer supports the HAProxy protocol, which transmits the original client connection information to the backend server. Syncplify Server! supports this protocol.

For more information, see the HAProxy protocol documentation and ensure you are familiar with its configuration and implications.

Example

ts
{
  if (Session) {
    var clientIP = Session.GetRemoteAddress();
    Log('Client IP is: ' + clientIP);  // ex: 192.168.99.10 or fe80::a117:3373:7fa5:177c
  } else {
    Log('Session object is not available.');
  }
}