Add redirect to HTTPS option
Summary: Rehash of D3411. In cgi/fcgi setups we have no idea if the request is HTTP or HTTPS as far as I can tell, so make this config-triggered again. Also handle @vrana's "off" case. Test Plan: Set this flag, observed redirect to https when `$_SERVER['HTTPS']` was absent. Reviewers: nh, vrana Reviewed By: nh CC: aran Differential Revision: https://secure.phabricator.com/D3420
This commit is contained in:
@@ -119,6 +119,15 @@ abstract class AphrontApplicationConfiguration {
|
||||
$request = $this->getRequest();
|
||||
$path = $request->getPath();
|
||||
|
||||
if (PhabricatorEnv::getEnvConfig('security.require-https')) {
|
||||
if (!$request->isHTTPS()) {
|
||||
$uri = $request->getRequestURI();
|
||||
$uri->setDomain($request->getHost());
|
||||
$uri->setProtocol('https');
|
||||
return $this->buildRedirectController($uri);
|
||||
}
|
||||
}
|
||||
|
||||
list($controller, $uri_data) = $this->buildControllerForPath($path);
|
||||
if (!$controller) {
|
||||
if (!preg_match('@/$@', $path)) {
|
||||
|
||||
Reference in New Issue
Block a user