Hi,
found another hint about ssl proxy:
http://www.php.net/manual/en/reserved.variables.server.php#93599
With all that information I succeeded in creating a working patch (against git
from this evening).
It would be great if that could be integrated into owncloud.
Regards
Thomas aka thessy
Am Montag 07 November 2011, 22:23:52 schrieb Robin Appelman:
> Not entire sure, but I think $_SERVER['https'] doesn't have to be 'on'
> when https is used, just a non empty value.
>
> - Robin Appelman
>
> On Mon, Nov 7, 2011 at 22:10, <[email protected]> wrote:
> > Hi,
> >
> > installing oc (from git) on my shared web hosting provider (Hosteurope)
> > works fine. I want to use it over https. Therefore a so called shared
> > SSL Certificate (SSL Proxy) exists.
> >
> > So my domain "www.besser.de" is available over
> > "https://ssl.webpack.de/besser.de"
> >
> > Added a new config value 'sslproxy' with the right value and tried to
> > patch 'lib/base.php' (line 115 ff):
> >
> > if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') {
> > $sslproxy = OC_Config::getValue( "sslproxy", false );
> > if (isset($sslproxy)) {
> > $url = "https://". $sslproxy . $_SERVER['REQUEST_URI'];
> > } else {
> > $url = "https://". $_SERVER['SERVER_NAME'] .
> > $_SERVER['REQUEST_URI'];
> > }
> >
> > But it ends with an infinite loop. Any hints where the problem could be?
> >
> > Thanks in advance...
> > Thomas
> > _______________________________________________
> > Owncloud mailing list
> > [email protected]
> > https://mail.kde.org/mailman/listinfo/owncloud
diff --git 3rdparty/Sabre/HTTP/Request.php 3rdparty/Sabre/HTTP/Request.php
index 95a6417..c89a6b4 100644
--- 3rdparty/Sabre/HTTP/Request.php
+++ 3rdparty/Sabre/HTTP/Request.php
@@ -138,9 +138,13 @@ class Sabre_HTTP_Request {
* @return string
*/
public function getUri() {
-
- return $this->_SERVER['REQUEST_URI'];
-
+
+ if ( isset($this->_SERVER['HTTP_X_FORWARDED_SERVER']) ) {
+ $uri = "/" . $this->_SERVER['SERVER_NAME'] . $this->_SERVER['REQUEST_URI'];
+ return $uri;
+ } else {
+ return $this->_SERVER['REQUEST_URI'];
+ }
}
/**
diff --git config/config.sample.php config/config.sample.php
index a40ce07..d91199a 100644
--- config/config.sample.php
+++ config/config.sample.php
@@ -11,6 +11,7 @@ $CONFIG = array(
"dbhost" => "",
"dbtableprefix" => "",
"forcessl" => false,
+"forcesslproxy" => "", // for example "ssl.example.com"
"enablebackup" => false,
// "datadirectory" => ""
);
diff --git lib/base.php lib/base.php
index c52b449..84f2f2b 100644
--- lib/base.php
+++ lib/base.php
@@ -102,6 +102,11 @@ class OC{
}
OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI));
+ // if a ssl proxy is used HTTP_X_FORWARDED_SERVER is set, the SERVER_NAME is usual a directory in the url
+ if ( isset($_SERVER['HTTP_X_FORWARDED_SERVER']) ) {
+ OC::$WEBROOT="/" . $_SERVER['SERVER_NAME'] . OC::$WEBROOT;
+ }
+
if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){
OC::$WEBROOT='/'.OC::$WEBROOT;
}
@@ -119,6 +124,14 @@ class OC{
}
}
+ // redirect to https proxy site if configured and not yet redirected
+ if( $sslproxy = OC_Config::getValue( "forcesslproxy", false ) AND !isset($_SERVER['HTTP_X_FORWARDED_SERVER'])){
+ ini_set("session.cookie_secure", "on");
+ $url = "https://". $sslproxy . "/" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
+ header("Location: $url");
+ exit();
+ }
+
ini_set('session.cookie_httponly','1;');
session_start();
_______________________________________________
Owncloud mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/owncloud