From b5fb37b939cc3a587d9ae566878786dcdc2c456e Mon Sep 17 00:00:00 2001 From: Liviu-Mihail Concioiu Date: Sun, 14 Sep 2025 21:00:21 +0200 Subject: [PATCH] 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 * Remove whitespace Signed-off-by: Liviu-Mihail Concioiu * Update libraries/classes/Controllers/HomeController.php Co-authored-by: William Desportes --------- Signed-off-by: Liviu-Mihail Concioiu Co-authored-by: William Desportes --- doc/faq.rst | 21 +++++++++++++++++++ .../classes/Controllers/HomeController.php | 16 ++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/doc/faq.rst b/doc/faq.rst index 1cc7d295ec..7d9abad4f1 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -725,6 +725,27 @@ can be set to use the older authentication with a command such as .. seealso:: , , +.. _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:: , , , + .. _faqconfig: Configuration diff --git a/libraries/classes/Controllers/HomeController.php b/libraries/classes/Controllers/HomeController.php index c4b929f970..d3c0f6c58e 100644 --- a/libraries/classes/Controllers/HomeController.php +++ b/libraries/classes/Controllers/HomeController.php @@ -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(); }