[Pkg-owncloud-commits] [owncloud] 134/394: backport pullrequest #554 better reverse proxy support

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:11:46 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit f359c2a716d69144c15fe9af856d8d985def8416
Author: Frank Karlitschek <frank at owncloud.org>
Date:   Fri Nov 23 12:48:54 2012 +0100

    backport pullrequest #554
    better reverse proxy support
---
 config/config.sample.php |    8 +++++++-
 lib/request.php          |    6 ++++++
 ocs/providers.php        |    2 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/config/config.sample.php b/config/config.sample.php
index 09eb605..aec9c45 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -30,6 +30,12 @@ $CONFIG = array(
 /* Force use of HTTPS connection (true = use HTTPS) */
 "forcessl" => false,
 
+/* The automatic hostname detection of ownCloud can fail in certain reverse proxy situations. This option allows to manually override the automatic detection. You can also add a port. For example "www.example.com:88" */
+"overwritehost" => "",
+
+/* The automatic protocol detection of ownCloud can fail in certain reverse proxy situations. This option allows to manually override the protocol detection. For example "https" */
+"overwriteprotocol" => "",
+
 /* Theme to use for ownCloud */
 "theme" => "",
 
@@ -104,4 +110,4 @@ $CONFIG = array(
 		'writable' => true,
   ),
  ),
-);
\ No newline at end of file
+);
diff --git a/lib/request.php b/lib/request.php
index 87262d9..10a03a2 100644
--- a/lib/request.php
+++ b/lib/request.php
@@ -18,6 +18,9 @@ class OC_Request {
 		if(OC::$CLI) {
 			return 'localhost';
 		}
+		if(OC_Config::getValue('overwritehost', '')<>''){
+			return OC_Config::getValue('overwritehost'); 
+		}
 		if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
 			if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ",") !== false) {
 				$host = trim(array_pop(explode(",", $_SERVER['HTTP_X_FORWARDED_HOST'])));
@@ -40,6 +43,9 @@ class OC_Request {
 	* Returns the server protocol. It respects reverse proxy servers and load balancers
 	*/
 	public static function serverProtocol() {
+		if(OC_Config::getValue('overwriteprotocol', '')<>''){
+			return OC_Config::getValue('overwriteprotocol'); 
+		}
 		if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
 			$proto = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']);
 		}else{
diff --git a/ocs/providers.php b/ocs/providers.php
index 4c68ded..fa01deb 100644
--- a/ocs/providers.php
+++ b/ocs/providers.php
@@ -23,7 +23,7 @@
 
 require_once '../lib/base.php';
 
-$url='http://'.substr(OCP\Util::getServerHost().$_SERVER['REQUEST_URI'], 0, -17).'ocs/v1.php/';
+$url=OCP\Util::getServerProtocol().'://'.substr(OCP\Util::getServerHost().$_SERVER['REQUEST_URI'], 0, -17).'ocs/v1.php/';
 
 echo('
 <providers>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list