Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/check/PhabricatorWebServerSetupCheck.php
- This file was added.
<?php | |||||
final class PhabricatorWebServerSetupCheck extends PhabricatorSetupCheck { | |||||
public function getDefaultGroup() { | |||||
return self::GROUP_OTHER; | |||||
} | |||||
protected function executeChecks() { | |||||
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); | |||||
$base_uri = id(new PhutilURI($base_uri)) | |||||
epriestley: Debugging? | |||||
Done Inline ActionsOops, yeah. joshuaspence: Oops, yeah. | |||||
->setPath('/status/'); | |||||
// If `phabricator.base-uri` is not set then we can't really do anything. | |||||
if (!$base_uri) { | |||||
return; | |||||
} | |||||
// Make sure that we don't recursively call the setup check. | |||||
if (AphrontRequest::getHTTPHeader('X-Phabricator-Setup-Check')) { | |||||
return; | |||||
} | |||||
$future = id(new HTTPSFuture($base_uri)) | |||||
->addHeader('Accept-Encoding', 'gzip') | |||||
->addHeader('Connection', 'Close') | |||||
Done Inline ActionsWhat's the reasoning for this? I'd expect us to just use the same domain? epriestley: What's the reasoning for this? I'd expect us to just use the same domain? | |||||
Done Inline ActionsI guess it's probably not worth it, but I figured that you might have to hit the web server directly instead of potentially going through a load balancer. joshuaspence: I guess it's probably not worth it, but I figured that you might have to hit the web server… | |||||
->addHeader('X-Phabricator-Setup-Check', true) | |||||
->setTimeout(5); | |||||
list($status, $body, $headers) = $future->resolve(); | |||||
if (BaseHTTPFuture::getHeader($headers, 'Content-Encoding') != 'gzip') { | |||||
$this->newIssue('webserver.gzip') | |||||
->setName(pht('Enable gzip compression')) | |||||
->setMessage( | |||||
pht( | |||||
'All modern browsers support and automatically negotiate gzip '. | |||||
'compression for all HTTP requests. Enabling gzip compression '. | |||||
'can reduce the size of the transferred response by up to 90%, '. | |||||
'which can significantly reduce the amount of time to download '. | |||||
'the resource, reduce data usage for the client, and improve '. | |||||
Done Inline ActionsWe should expand this but I can counter-diff you on that. epriestley: We should expand this but I can counter-diff you on that. | |||||
Done Inline ActionsYeah, I'll expand on this a bit but it's probably better that the copy comes from you. joshuaspence: Yeah, I'll expand on this a bit but it's probably better that the copy comes from you. | |||||
'the time to first render of your pages.')); | |||||
return; | |||||
} | |||||
} | |||||
} |
Debugging?