WebDAV HTTP authorization does not work
From froelix.com - Wiki
Problem:
- After trying to login to the WebDAV page of owncoud, the login window appears again and again.
- This problem occurs if PHP is used as a CGI module.
Solution:
- Change the Rewrite Rule of the .htaccess file to:
RewriteRule .* - [env=REMOTE_USER:%{HTTP:Authorization},last]
- Insert behind the following lines of the file /lib/base.php
//set http auth headers for apache+php-cgi work around if variable gets renamed by apache
if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches))
{
list($name, $password) = explode(':', base64_decode($matches[1]));
$_SERVER['PHP_AUTH_USER'] = strip_tags($name);
$_SERVER['PHP_AUTH_PW'] = strip_tags($password);
}
this code snippet:
if (isset($_SERVER['REDIRECT_REMOTE_USER']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_REMOTE_USER'], $matches))
{
list($name, $password) = explode(':', base64_decode($matches[1]));
$_SERVER['PHP_AUTH_USER'] = strip_tags($name);
$_SERVER['PHP_AUTH_PW'] = strip_tags($password);
}
Note: