Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/configuration/AphrontApplicationConfiguration.php
Show First 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | if ($cluster_addresses) { | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$site = $this->buildSiteForRequest($request); | $site = $this->buildSiteForRequest($request); | ||||
if ($site->shouldRequireHTTPS()) { | if ($site->shouldRequireHTTPS()) { | ||||
if (!$request->isHTTPS()) { | if (!$request->isHTTPS()) { | ||||
// Don't redirect intracluster requests: doing so drops headers and | |||||
// parameters, imposes a performance penalty, and indicates a | |||||
// misconfiguration. | |||||
if ($request->isProxiedClusterRequest()) { | |||||
throw new AphrontMalformedRequestException( | |||||
pht('HTTPS Required'), | |||||
pht( | |||||
'This request reached a site which requires HTTPS, but the '. | |||||
'request is not marked as HTTPS.')); | |||||
} | |||||
$https_uri = $request->getRequestURI(); | $https_uri = $request->getRequestURI(); | ||||
$https_uri->setDomain($request->getHost()); | $https_uri->setDomain($request->getHost()); | ||||
$https_uri->setProtocol('https'); | $https_uri->setProtocol('https'); | ||||
// In this scenario, we'll be redirecting to HTTPS using an absolute | // In this scenario, we'll be redirecting to HTTPS using an absolute | ||||
// URI, so we need to permit an external redirect. | // URI, so we need to permit an external redirect. | ||||
return $this->buildRedirectController($https_uri, true); | return $this->buildRedirectController($https_uri, true); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 287 Lines • Show Last 20 Lines |