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:
@@ -119,6 +119,14 @@ abstract class AphrontApplicationConfiguration {
|
|||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$path = $request->getPath();
|
$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);
|
list($controller, $uri_data) = $this->buildControllerForPath($path);
|
||||||
if (!$controller) {
|
if (!$controller) {
|
||||||
if (!preg_match('@/$@', $path)) {
|
if (!preg_match('@/$@', $path)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user