Raise early fatal for bad rewrite with no "/"
Summary: This particular misconfiguration results in a difficult-to-debug redirect loop, so stop it early. Test Plan: Broke my rewrite rule, verified I got yelled at. Reviewers: btrahan, chad Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D4591
This commit is contained in:
@@ -221,7 +221,7 @@ final class PhabricatorStartup {
|
||||
* @task valiation
|
||||
*/
|
||||
private static function verifyRewriteRules() {
|
||||
if (isset($_REQUEST['__path__'])) {
|
||||
if (isset($_REQUEST['__path__']) && strlen($_REQUEST['__path__'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -229,11 +229,21 @@ final class PhabricatorStartup {
|
||||
// Compatibility with PHP 5.4+ built-in web server.
|
||||
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||
$_REQUEST['__path__'] = $url['path'];
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['__path__'])) {
|
||||
self::didFatal(
|
||||
"Request parameter '__path__' is not set. Your rewrite rules ".
|
||||
"are not configured correctly.");
|
||||
}
|
||||
|
||||
if (!strlen($_REQUEST['__path__'])) {
|
||||
self::didFatal(
|
||||
"Request parameter '__path__' is set, but empty. Your rewrite rules ".
|
||||
"are not configured correctly. The '__path__' should always ".
|
||||
"begin with a '/'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user