mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-11-29 11:24:11 +01:00
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.
This commit is contained in:
parent
e7ff1de64a
commit
5dc1c806d9
@ -22,7 +22,7 @@
|
||||
|
||||
OCP\App::checkAppEnabled('contacts');
|
||||
|
||||
if(substr($_SERVER["REQUEST_URI"], 0, strlen(OC_App::getAppWebPath('contacts').'/carddav.php')) == OC_App::getAppWebPath('contacts').'/carddav.php') {
|
||||
if(substr(OCP\Util::getRequestUri(), 0, strlen(OC_App::getAppWebPath('contacts').'/carddav.php')) == OC_App::getAppWebPath('contacts').'/carddav.php') {
|
||||
$baseuri = OC_App::getAppWebPath('contacts').'/carddav.php';
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ OC_App::loadApps($RUNTIME_APPTYPES);
|
||||
$authBackend = new OC_Connector_Sabre_Auth();
|
||||
$principalBackend = new OC_Connector_Sabre_Principal();
|
||||
$carddavBackend = new OC_Connector_Sabre_CardDAV();
|
||||
$requestBackend = new OC_Connector_Sabre_Request();
|
||||
|
||||
// Root nodes
|
||||
$principalCollection = new Sabre_CalDAV_Principal_Collection($principalBackend);
|
||||
@ -49,6 +50,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'));
|
||||
|
@ -24,7 +24,7 @@ OCP\JSON::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('contacts');
|
||||
session_write_close();
|
||||
|
||||
//OCP\Util::writeLog('contacts', $_SERVER["REQUEST_URI"], OCP\Util::DEBUG);
|
||||
//OCP\Util::writeLog('contacts', OCP\Util::getRequestUri(), OCP\Util::DEBUG);
|
||||
|
||||
function getStandardImage() {
|
||||
OCP\Response::enableCaching();
|
||||
|
Loading…
Reference in New Issue
Block a user