1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Redirect to https

Summary:
If the phabricator.base-uri is set up with https and phabricator receives
a request that isn't over ssl, we will issue a redirect response to the user
to force them to use https.

Test Plan:
With this disabled, verified that pages still load correctly over http.
Enabled it; verified I get redirected to the same path but on https when I
make an http request; verified https requests get served without a redirect.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3411
This commit is contained in:
Nick Harper 2012-08-30 16:11:23 -07:00
parent daabc41fa1
commit 8afc7fc2cd

View file

@ -119,6 +119,14 @@ abstract class AphrontApplicationConfiguration {
$request = $this->getRequest();
$path = $request->getPath();
// Check if we should do an HTTP -> HTTPS redirect
$base_uri = new PhutilURI(
PhabricatorEnv::getEnvConfig('phabricator.base-uri'));
if ($base_uri->getProtocol() === 'https' && !$_SERVER['HTTPS']) {
$base_uri->setPath($path);
return $this->buildRedirectController($base_uri);
}
list($controller, $uri_data) = $this->buildControllerForPath($path);
if (!$controller) {
if (!preg_match('@/$@', $path)) {