to long http header cause Nginx to reject the response with 502

upstream sent too big header while reading response header from upstream
This commit is contained in:
Ralf Becker 2018-12-06 17:53:44 +08:00
parent ab76966e02
commit b3079c3df6

View File

@ -143,6 +143,8 @@ function egw_exception_handler($e)
elseif($GLOBALS['egw_info']['flags']['no_exception_handler'] == 'basic_auth')
{
$error = str_replace(array("\r", "\n"), array('', ' | '), $e->getMessage());
// to long http header cause Nginx to reject the response with 502 upstream sent too big header while reading response header from upstream
if (strlen($error) > 256) $error = substr($error, 0, 256).' ...';
header('WWW-Authenticate: Basic realm="'.$headline.' '.$error.'"');
header('HTTP/1.1 401 Unauthorized');
header('X-WebDAV-Status: 401 Unauthorized', true);