public static function absoluteBaseURLWithAuth(HTTPRequest $request = null)
    {
        // Detect basic auth
        $user = $request->getHeader('PHP_AUTH_USER');
        if ($user) {
            $password = $request->getHeader('PHP_AUTH_PW');
            $login = sprintf("%s:%s@", $user, $password) ;
        } else {
            $login = '';
        }

        return Director::protocol($request) . $login . static::host($request) . Director::baseURL();
    }