• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Resolved Plesk returns server's IP instead of subscription's IP

eArmin

New Pleskian
My Plesk server main public IP on Centos 7 is 10.10.10.10 and there is also another dedicated IP assigned to a subscription domains e.g. 20.20.20.20. All websites and DNS settings are working fine, but PHP and other APIs showing server's main public IP instead of domains (Subscriptions) IP, so the requests from websites are not authorized on IP limited services and actually the output IP of websites requests are wrong. I am using this code to get the IP.

Thank you.

PHP:
<?php
// create a new cURL resource
$ch = curl_init ();

// set URL and other appropriate options
curl_setopt ($ch, CURLOPT_URL, "http://ipecho.net/plain");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);

// grab URL and pass it to the browser

$ip = curl_exec ($ch);
echo "The public ip for this server is: $ip";
// close cURL resource, and free up system resources
curl_close ($ch);
?>
 
The behavior is correct, because outgoing traffic uses the default interface and the default ip address. Maybe one of these solutions can help:

Solution 1:
$ip = "xxx.xxx.xxx.xxx"; // enter custom ip
curl_setopt($ch, CURLOPT_HTTPHEADER, ["REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"]);

Solution 2:
$interfacename = 'eth0'; // enter the interface name that is linked to the ip that you want to use
curl_setopt($ch, CURLOPT_INTERFACE, $interfacename);
 
The behavior is correct, because outgoing traffic uses the default interface and the default ip address. Maybe one of these solutions can help:

Solution 1:
$ip = "xxx.xxx.xxx.xxx"; // enter custom ip
curl_setopt($ch, CURLOPT_HTTPHEADER, ["REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"]);

Solution 2:
$interfacename = 'eth0'; // enter the interface name that is linked to the ip that you want to use
curl_setopt($ch, CURLOPT_INTERFACE, $interfacename);

That's great. Thank you so much, Solution 2 worked for me.

Now I worry about the correct IP and reverse DNS configuration for Mail Services for domains with dedicated IPs too! Actually, I have posted a topic in Hetzner's forums. but since it may be offtopic I will open a new thread later.
 
Back
Top