• 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!
  • 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.

Forwarded to devs Plesk Obsidian PHP $_SERVER['SERVER_ADDR'] returns 127.0.0.1

danami

Silver Pleskian
TITLE:
Plesk Obsidian PHP $_SERVER['SERVER_ADDR'] returns 127.0.0.1
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:
Product version: Plesk Obsidian 18.0.20.0
OS version: CloudLinux 7.7 x86_64
Build date: 2019/10/18 18:00
Revision: e02f419139a3325041284ef4acc15b1fbbd9b2c4
PROBLEM DESCRIPTION:
Plesk Obsidian 18.0.20.0 the panel PHP is returning '127.0.0.1' for the $_SERVER['SERVER_ADDR'] when the user accesses the panel using the servers IP address:

Example:
https://serverip:8443 returns 127.0.0.1
https://hostname:8443 returns the proper IP address.
STEPS TO REPRODUCE:
Create the file `/usr/local/psa/admin/htdocs/test.php` with the following contents:

Code:
<?php
echo $_SERVER['SERVER_ADDR'];
?>

Now access the file in the panel using https://serverip:8443/test.php and it will output '127.0.0.1' not the servers IP address.​
ACTUAL RESULT:
127.0.0.1​
EXPECTED RESULT:
The servers IP address should be returned properly regardless of using the hostname or IP address.​
ANY ADDITIONAL INFORMATION:
This causes problems for plesk extension developers who rely on this on being correct.
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
Confirm bug
 
Last edited:
In Obsidian there is a new feature: access Plesk with 443 port. This feature is optional, but you likely use it.

In this case, you open https://domain.tld/test.php which is actually one more reverse proxy to http://127.0.0.1:8880/test.php and you receive 127.0.0.1 in the server address variable.

If you need a server IP address, I would recommend finding a more reliable way for it, at least we don't use $_SERVER['SERVER_ADDR']
 
IgnorG then why does $_SERVER['SERVER_ADDR'] work fine as on Plesk Obsidian on Centos? Like I said only CloudLinux is affected. Also I'm accessing the panel using https://serverip:8443/test.php NOT https://domain.tld/test.php . (notice that I have the :8443 port in there). I'm talking about the Plesk PHP used by Plesk extensions not the PHP for websites used by the server.
 
From developer:

However, we do not modify this variable. We cannot consider it as a bug in Plesk.
As I said the variable is not reliable and not recommended for usage in extensions.
 
Back
Top