Fix #19570 - Check for HTTP_HOST and document the issue in FAQ (#19858)

Fixes #19570

* Check for HTTP_HOST and document the issue in FAQ

Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>

* Remove whitespace

Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>

* Update libraries/classes/Controllers/HomeController.php

Co-authored-by: William Desportes <williamdes@wdes.fr>

---------

Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
Co-authored-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
Liviu-Mihail Concioiu 2025-09-14 21:00:21 +02:00 committed by GitHub
parent f28ac15745
commit b5fb37b939
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 0 deletions

View File

@ -725,6 +725,27 @@ can be set to use the older authentication with a command such as
.. seealso:: <https://github.com/phpmyadmin/phpmyadmin/issues/14220>, <https://stackoverflow.com/questions/49948350/phpmyadmin-on-mysql-8-0>, <https://bugs.php.net/bug.php?id=76243>
.. _faq1_46:
1.46 Missing ``HTTP_HOST`` variable when using nginx with HTTP/3
-----------------------------------------------------------------------------------------------------------
When using phpMyAdmin with nginx and HTTP/3 enabled, the ``HTTP_HOST`` variable may be missing due to a known issue with nginx's HTTP/3 implementation, which can cause several issues:
- Two-factor authentication won't work
- Exported settings have no hostname in the filename (e.g., ``phpMyAdmin-config-.json``)
- The hostname is missing from the page title (empty ``@HTTP_HOST@``)
To fix this issue, add the following line to your nginx configuration:
.. code-block:: nginx
fastcgi_param HTTP_HOST $host;
This line should be placed in the server block of your nginx configuration where the PHP-FPM settings are defined.
.. seealso:: <https://github.com/php/php-src/issues/13021>, <https://github.com/nginx/nginx/issues/455>, <https://trac.nginx.org/nginx/ticket/2281>, <https://mailman.nginx.org/pipermail/nginx-devel/2024-January/3CQEHII5QU2BTQ7L7DAVCBWK3OQS3GU6.html>
.. _faqconfig:
Configuration

View File

@ -8,6 +8,7 @@ use PhpMyAdmin\Charsets;
use PhpMyAdmin\CheckUserPrivileges;
use PhpMyAdmin\Config;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Core;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Git;
use PhpMyAdmin\Html\Generator;
@ -398,6 +399,21 @@ class HomeController extends AbstractController
];
}
/**
* Check for missing HTTP_HOST
* This commonly occurs with nginx >= 1.25.0 and HTTP/3 configurations
*/
if (Core::getenv('HTTP_HOST') === '') {
$this->errors[] = [
'message' => __(
'The [code]HTTP_HOST[/code] variable is missing,'
. ' which might cause phpMyAdmin to not work properly.'
. ' Please refer to [doc@faq1-46]documentation[/doc] for possible issues.',
),
'severity' => 'warning',
];
}
$this->checkLanguageStats();
}