Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing authentication to servers without mod_rewrite (Webfaction) #294

Closed
filipesaraiva opened this issue Jul 2, 2016 · 5 comments
Closed

Comments

@filipesaraiva
Copy link

Hello NextCloud developers, I had this problem since the old times of ownCloud, and all the time when I need to update my ownCloud instance I need to apply this patch. It have the same behavior in NextCloud.

The problem is described here:

The main HTTP authentication examples in the PHP documentation don't work on our servers because we use php-cgi to serve your PHP sites.
The common workarounds for that problem involve setting a HTTP_AUTHENTICATION environment variable via mod_rewrite, but that doesn't work on our servers because our php-cgi environment runs on Apache with suExec, which does not pass environment variables to CGI scripts.

A developer created a patch to solve it. In past I submitted an issue and a pull request with this patch, but a developer talked the best way to fix it is creating an application to provide authentication using a specific method for this case.

Cheers;

@MorrisJobke
Copy link
Member

MorrisJobke commented Jul 4, 2016

The app basically should do this:

//sett http auth headers for Webfaction workaround
if(isset($_GET['Authorization']) && preg_match('/Basic\s+(.*)$/i', $_GET['Authorization'], $matches))
{
    list($name, $password) = explode(':', base64_decode($matches[1]));
    $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
    $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
}

within the appinfo/app.php and specify that it is an authentication app (so it's loaded earlier):

<types>
<authentication/>
</types>

Is this correct @LukasReschke ?

@filipesaraiva
Copy link
Author

Does the app need to change the .htaccess too?

@nickvergessen
Copy link
Member

No, the app only needs to execute the code from above in it's app.php

@filipesaraiva
Copy link
Author

Hi, why did you close it? Was that code added in NextCloud?

@nickvergessen
Copy link
Member

No, since it should be an app on it's own

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants