Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-12-15 01:24:19 +0300
committervipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-12-15 01:24:19 +0300
commit512c24069319227ea3834b90ed6d9e4a2c4e7c47 (patch)
tree1614cbb274e9c1ca850bdd64e8278f2a5cf1cb25 /plugins/Installation
parentab9e2b542914224e095f1a02bbeb8d71d0c2fbe1 (diff)
fixes #869 - Installation - detect presence of a reverse proxy and warn if mismatch with $_SERVER['HTTPS']; add 'reverse_proxy' config setting
Diffstat (limited to 'plugins/Installation')
-rw-r--r--plugins/Installation/Controller.php39
-rw-r--r--plugins/Installation/templates/systemCheck.tpl6
-rw-r--r--plugins/Installation/templates/welcome.tpl11
3 files changed, 56 insertions, 0 deletions
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index facabedbf5..e72671da86 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -319,6 +319,7 @@ class Piwik_Installation_Controller extends Piwik_Controller
'login' => $form->getSubmitValue('login'),
'password' => md5( $form->getSubmitValue('password') ),
'email' => $form->getSubmitValue('email'),
+ 'salt' => Piwik_Common::generateUniqId(),
);
$this->session->superuser_infos = $superUserInfos;
@@ -637,9 +638,47 @@ class Piwik_Installation_Controller extends Piwik_Controller
$infos['isWindows'] = substr(PHP_OS, 0, 3) == 'WIN';
+ $infos['protocol_ok'] = true;
+ $infos['protocol'] = self::getProtocolInformation();
+ if(Piwik_Url::getCurrentScheme() == 'http' &&
+ $infos['protocol'] !== null)
+ {
+ $infos['protocol_ok'] = false;
+ }
+
return $infos;
}
+ public static function getProtocolInformation()
+ {
+ if(Piwik_Common::getRequestVar('clientProtocol', 'http', 'string') == 'https')
+ {
+ return 'https';
+ }
+
+ if(isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)
+ {
+ return 'SERVER_PORT=443';
+ }
+
+ if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')
+ {
+ return 'X-Forwarded-Proto';
+ }
+
+ if(isset($_SERVER['HTTP_X_FORWARDED_SCHEME']) && strtolower($_SERVER['HTTP_X_FORWARDED_SCHEME']) == 'https')
+ {
+ return 'X-Forwarded-Scheme';
+ }
+
+ if(isset($_SERVER['HTTP_X_URL_SCHEME']) && strtolower($_SERVER['HTTPS']) == 'HTTP_X_URL_SCHEME')
+ {
+ return 'X-Url-Scheme';
+ }
+
+ return null;
+ }
+
protected function skipThisStep( $step )
{
if(isset($this->session->skipThisStep[$step])
diff --git a/plugins/Installation/templates/systemCheck.tpl b/plugins/Installation/templates/systemCheck.tpl
index 75b3c6843b..0de5f0c938 100644
--- a/plugins/Installation/templates/systemCheck.tpl
+++ b/plugins/Installation/templates/systemCheck.tpl
@@ -165,6 +165,12 @@
{/foreach}
</td>
</tr>
+ <tr>
+ <td class="label">{'Installation_SystemCheckProtocol'|translate}</td>
+ <td>
+ {if $infos.protocol_ok}{$ok}{else}{$warning} {$infos.protocol}<br /><i>{'Installation_SystemCheckProtocolHelp'|translate}</i><br /><br /><code>[General]</code><br /><code>reverse_proxy = 1</code><br />{/if}
+ </td>
+ </tr>
</table>
<p>
diff --git a/plugins/Installation/templates/welcome.tpl b/plugins/Installation/templates/welcome.tpl
index c2985c3c36..40b958a78e 100644
--- a/plugins/Installation/templates/welcome.tpl
+++ b/plugins/Installation/templates/welcome.tpl
@@ -2,3 +2,14 @@
{'Installation_WelcomeHelp'|translate:$totalNumberOfSteps}
+{literal}
+<script type="text/javascript">
+<!--
+$(function() {
+if (document.location.protocol === 'https:') {
+ $('p.nextStep a').attr('href', $('p.nextStep a').attr('href') + '&clientProtocol=https');
+}
+});
+//-->
+</script>
+{/literal}