• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Issue Nginx $_SERVER['HTTP_HOST'] incorrect

JeroenK

New Pleskian
Server operating system version
AlmaLinux 9.6
Plesk version and microupdate number
18.0.72 Update #1
We discovered a weird setting where php's $_SERVER['HTTP_HOST'] is always set to the domain alias's target. Previously, expected and on a copy of the same subscription, its supposed to display the current url.
This is necessary because of Prestashop Multistore.
main url: url.nl
Alias: URL.com (not 301 redirected)
On the index (/) opening .com its displaying the .nl as HTTP_HOST.
host_dump_on_index.png

However, creating a seperate php file to dump the exact same code, its correct:
host_dump_on_not_index.png


I believe it has something to do with the proxy of nginx.
possible_incorrect_settings.png
The copy we have created a month ago does not contain the *_ip_default.conf file.

I have:
fastcgi_param HTTP_HOST $host;
set in 'Additional nginx directives'.

$host does seem to be the correct value:

1756460913205.png

1756461079794.png

Any further info can be given.
 
Thank you for the confirmation. Please try setting it to 'none'. We have a registered bug that I think might be the reason for the issue you are reporting. Kindly confirm if that action sorted the issue. Thank you in advance.
 
Hi Sebahat,
Thanks for checking. I guess it's set correctly?
View attachment 28625

I've assigned on ipv4 only, sharing the same ip.

@JeroenK,

Please remove the

host : $host

custom value set in 'Additional nginx directives'.

This custom value should not be needed at all.

For Nginx, this is - in this precedence : a hostname from the request line, a hostname from the Host request header or the server name matching a request.

That is already taken care of in default Plesk Nginx config and is not related to the fastcgi_param entries.


After removal of that entry, then (first) check whether you still have the same issue (or that the issue changes a bit).

If you still have an issue (after removal), then it might be related to the bug mentioned by @Sebahat.hadzhi .

The workaround of @Sebahat.hadzhi can be used to combat the bug temporarily.


I hope the above helps a bit.

Kind regards....
 
Back
Top