• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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