summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2012-05-31 20:16:44 +0200
committerFrank Karlitschek <frank@owncloud.org>2012-05-31 20:16:44 +0200
commit5d425a9f799bf385d686d4f08f571509123899f6 (patch)
tree7170f934a5db5bbd433ab84faae19831765f52cd /lib
parent7ec3e37199c28cd289699e226254b571ca5c5938 (diff)
downloadnextcloud-server-5d425a9f799bf385d686d4f08f571509123899f6.tar.gz
nextcloud-server-5d425a9f799bf385d686d4f08f571509123899f6.zip
use our own serverHost call so that ownCloud works with reverse proxy servers
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php8
-rw-r--r--lib/ocs.php4
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/base.php b/lib/base.php
index 30d302b3912..b2ec38ffdb8 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -211,9 +211,11 @@ class OC{
if( OC_Config::getValue( "forcessl", false )){
ini_set("session.cookie_secure", "on");
if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') {
- $url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
- header("Location: $url");
- exit();
+ if(!isset($_SERVER['HTTP_X_FORWARDED_PROTO']) or $_SERVER['HTTP_X_FORWARDED_PROTO']=='http') {
+ $url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
+ header("Location: $url");
+ exit();
+ }
}
}
}
diff --git a/lib/ocs.php b/lib/ocs.php
index 536ee754e84..aba29275a92 100644
--- a/lib/ocs.php
+++ b/lib/ocs.php
@@ -357,11 +357,11 @@ class OC_OCS {
*/
private static function apiConfig($format) {
$user=OC_OCS::checkpassword(false);
- $url=substr($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'],0,-11).'';
+ $url=substr(OC_Helper::serverHost().$_SERVER['SCRIPT_NAME'],0,-11).'';
$xml['version']='1.5';
$xml['website']='ownCloud';
- $xml['host']=$_SERVER['HTTP_HOST'];
+ $xml['host']=OC_Helper::serverHost();
$xml['contact']='';
$xml['ssl']='false';
echo(OC_OCS::generatexml($format,'ok',100,'',$xml,'config','',1));