summaryrefslogtreecommitdiffstats
path: root/lib/connector
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <stefan@herbrechtsmeier.net>2012-09-09 12:54:47 +0200
committerherbrechtsmeier <stefan@herbrechtsmeier.net>2013-01-31 18:42:31 +0100
commitab2b79cda682a697baba2128a21d3a9b5e90853c (patch)
treefbaf5a643bbfa2c4236d574ecb41784f5c859d15 /lib/connector
parent411e8e5218e0b0d6dc7e993f283b8a457f780af9 (diff)
downloadnextcloud-server-ab2b79cda682a697baba2128a21d3a9b5e90853c.tar.gz
nextcloud-server-ab2b79cda682a697baba2128a21d3a9b5e90853c.zip
add multiple domains reverse proxy support
Add support for a reverse proxy that handles multiple domains via different web roots (http[s]://proxy.tld/domain.tld/owncloud). 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 and extend this functions to overwrite the web root. Additionally it adds a Sabre request backend that extends the Sabre_HTTP_Request to use the same functions.
Diffstat (limited to 'lib/connector')
-rw-r--r--lib/connector/sabre/request.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/connector/sabre/request.php b/lib/connector/sabre/request.php
new file mode 100644
index 00000000000..97a27996bf3
--- /dev/null
+++ b/lib/connector/sabre/request.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * ownCloud
+ *
+ * @author Stefan Herbrechtsmeier
+ * @copyright 2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+class OC_Connector_Sabre_Request extends Sabre_HTTP_Request {
+ /**
+ * Returns the requested uri
+ *
+ * @return string
+ */
+ public function getUri() {
+ return OC_Request::requestUri();
+ }
+
+ /**
+ * Returns a specific item from the _SERVER array.
+ *
+ * Do not rely on this feature, it is for internal use only.
+ *
+ * @param string $field
+ * @return string
+ */
+ public function getRawServerValue($field) {
+ if($field == 'REQUEST_URI'){
+ return $this->getUri();
+ }
+ else{
+ return isset($this->_SERVER[$field])?$this->_SERVER[$field]:null;
+ }
+ }
+}