Username:
TITLE
Missing HTTP_HOST Causes Incorrect URL Generation in WP Toolkit
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE
Plesk Obsidian 18.0.64 Update #1
AlmaLinux 8.10
WP Toolkit version 6.5.4-8879
PROBLEM DESCRIPTION
When using WP Toolkit in Plesk and switching the PHP handler to FPM application served by nginx, the $_SERVER['HTTP_HOST'] variable is undefined. This causes WordPress to generate incomplete URLs in the admin panel. For example, the pagination links on the "Pages" overview page lose the domain name, resulting in incorrect URLs like:
Instead of:
STEPS TO REPRODUCE
ACTUAL RESULT
The pagination links are missing the domain name (SITEURL) and appear as:
This results in a broken link and an inability to navigate between pages. Additionally, when WordPress debugging is turned on, a PHP warning appears in the wp-content/debug.log:
EXPECTED RESULT
Pagination links should include the correct domain name (SITEURL), as follows:
ANY ADDITIONAL INFORMATION
Temporary Workaround
Adding the following code to wp-config.php resolves the issue temporarily:
However, this is not a long-term solution and requires a proper fix at the server or WP Toolkit level.
Additional Notes
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM
Confirm bug
TITLE
Missing HTTP_HOST Causes Incorrect URL Generation in WP Toolkit
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE
Plesk Obsidian 18.0.64 Update #1
AlmaLinux 8.10
WP Toolkit version 6.5.4-8879
PROBLEM DESCRIPTION
When using WP Toolkit in Plesk and switching the PHP handler to FPM application served by nginx, the $_SERVER['HTTP_HOST'] variable is undefined. This causes WordPress to generate incomplete URLs in the admin panel. For example, the pagination links on the "Pages" overview page lose the domain name, resulting in incorrect URLs like:
Code:
https://wp-admin/edit.php?post_type=page&paged=2
Code:
https://domain.com/wp-admin/edit.php?post_type=page&paged=2
STEPS TO REPRODUCE
- In Plesk, switch a WordPress instance's PHP handler to FPM application served by nginx using WP Toolkit.
- Access the WordPress admin panel (/wp-admin).
- Navigate to Pages (Pages > All Pages) and click the pagination links at the top of the page.
ACTUAL RESULT
The pagination links are missing the domain name (SITEURL) and appear as:
Code:
https://wp-admin/edit.php?post_type=page&paged=2
This results in a broken link and an inability to navigate between pages. Additionally, when WordPress debugging is turned on, a PHP warning appears in the wp-content/debug.log:
Code:
PHP Warning: Undefined array key "HTTP_HOST" in /var/www/vhosts/domain.com/httpdocs/wp/wp-admin/includes/misc.php
EXPECTED RESULT
Pagination links should include the correct domain name (SITEURL), as follows:
Code:
https://domain.com/wp-admin/edit.php?post_type=page&paged=2
ANY ADDITIONAL INFORMATION
Temporary Workaround
Adding the following code to wp-config.php resolves the issue temporarily:
Code:
if (!isset($_SERVER['HTTP_HOST'])) {
$_SERVER['HTTP_HOST'] = 'domain.com'; // Replace with the actual domain
}
However, this is not a long-term solution and requires a proper fix at the server or WP Toolkit level.
Additional Notes
- The issue appears specific to the FPM application served by nginx configuration. Switching back to another PHP handler (e.g., Apache with nginx) resolves the issue.
- Likely related to nginx not passing the HTTP_HOST variable correctly to PHP-FPM in the default configuration.
- HTTP/3 is turned on the server.
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM
Confirm bug