add multiple domains reverse SSL proxy support

Add support for a reverse proxy that handles multiple domains via different
web roots (https://proxy.tld/domain.tld/owncloud) and only forwards SSL
connections unencrypted to the web server.

As the reverse proxy web root is transparent for the web server the
REQUEST_URI and SCRIPT_NAME need manual adjustments. This patch replace
the direct use of this _SERVER variables with function calls. Additionally
it adds a Sabre request backend that extends the Sabre_HTTP_Request to use
the same functions.
master
Stefan Herbrechtsmeier 2013-01-06 12:32:21 +01:00
parent 778e1ce985
commit 141a188649
1 changed files with 3 additions and 1 deletions

View File

@ -7,7 +7,7 @@
*/
OCP\App::checkAppEnabled('calendar');
if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('calendar').'/caldav.php')) == OC_App::getAppWebPath('calendar'). '/caldav.php') {
if(substr(OCP\Util::getRequestUri(),0,strlen(OC_App::getAppWebPath('calendar').'/caldav.php')) == OC_App::getAppWebPath('calendar'). '/caldav.php') {
$baseuri = OC_App::getAppWebPath('calendar').'/caldav.php';
}
@ -19,6 +19,7 @@ OC_App::loadApps($RUNTIME_APPTYPES);
$authBackend = new OC_Connector_Sabre_Auth();
$principalBackend = new OC_Connector_Sabre_Principal();
$caldavBackend = new OC_Connector_Sabre_CalDAV();
$requestBackend = new OC_Connector_Sabre_Request();
// Root nodes
$Sabre_CalDAV_Principal_Collection = new Sabre_CalDAV_Principal_Collection($principalBackend);
@ -34,6 +35,7 @@ $nodes = array(
// Fire up server
$server = new Sabre_DAV_Server($nodes);
$server->httpRequest = $requestBackend;
$server->setBaseUri($baseuri);
// Add plugins
$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud'));