Send the 419 status with a reason phrase so Apache does not answer 500 (4.0 backport) (#1213)

Backport of #1209 to `postfixadmin_4.0`, as asked for there. Refs #1208.

fix http 419 status header to include reason phrase.

thanks @vibpe
This commit is contained in:
vibpe authored and GitHub committed 2026-11-20 13:51:54 +00:00
1 parent 0ba30e3d69
commit 8d83e19773
1 file changed
+4 -1
+4 -1
View File
@@ -4,7 +4,10 @@ require_once(dirname(__FILE__) . '/../common.php');
function pfa_handle_invalid_token(): void
{
http_response_code(419); // HTTP 419 Page Expired.
// 419 is not a registered status code: without an explicit reason phrase
// Apache replaces the status line with "500 Internal Server Error".
// Always HTTP/1.1: mod_php only applies a status line starting with "HTTP/1.".
header('HTTP/1.1 419 Page Expired', true, 419);
$returnUrl = 'main.php';
$title = Config::lang('session_expired_title') ?: 'Session expired';