phacility/phabricator · error · Exception
Too many redirects trying to fetch remote URI.
Error message
Too many redirects trying to fetch remote URI.
What it means
Safety limiter in newFromFileDownload: the manually-followed redirect chain exceeded 10 hops (or hit the loop guard context), so fetching the remote URI is abandoned to avoid infinite redirect loops (see T6755).
Solutions
- Fetch the final destination URI directly instead of the redirecting one
- Fix the remote server if it redirect-loops
- Whitelist a more direct canonical URL for the resource
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/applications/files/storage/PhabricatorFile.php:597 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/a4e5c105dd087f27.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/files/storage/PhabricatorFile.php:597
/**
* Download a remote resource over HTTP and save the response body as a file.
*
* This method respects `security.outbound-blacklist`, and protects against
* HTTP redirection (by manually following "Location" headers and verifying
* each destination). It does not protect against DNS rebinding. See
* discussion in T6755.
*/
public static function newFromFileDownload($uri, array $params = array()) {
$timeout = 5;
$redirects = array();
$current = $uri;
while (true) {
try {
if (count($redirects) > 10) {
throw new Exception(
pht('Too many redirects trying to fetch remote URI.'));
}
$resolved = PhabricatorEnv::requireValidRemoteURIForFetch(
$current,
array(
'http',
'https',
));
list($resolved_uri, $resolved_domain) = $resolved;
$current = new PhutilURI($current);
if ($current->getProtocol() == 'http') {
// For HTTP, we can use a pre-resolved URI to defuse DNS rebinding.
$fetch_uri = $resolved_uri;
$fetch_host = $resolved_domain;
} else {View on GitHub (pinned to 5720a38cfe)