I solved by adding these lines to the .htaccess file.
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.)
RewriteRule . - [e=HTTP_AUTHORIZATION:%1]
seems to be a problem with some php-fpm configurations
I was inspired by Client login fails with 401
Thanks