diff --git a/src/aphront/configuration/AphrontApplicationConfiguration.php b/src/aphront/configuration/AphrontApplicationConfiguration.php index 4141bb005d..1f4a9dde11 100644 --- a/src/aphront/configuration/AphrontApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontApplicationConfiguration.php @@ -113,11 +113,17 @@ abstract class AphrontApplicationConfiguration { array( $base_uri, $prod_uri, - $file_uri, ), $conduit_uris, $allowed_uris); + $cdn_routes = array( + '/res/', + '/file/data/', + '/file/xform/', + '/phame/r/', + ); + $host_match = false; foreach ($uris as $uri) { if ($host === id(new PhutilURI($uri))->getDomain()) { @@ -126,6 +132,17 @@ abstract class AphrontApplicationConfiguration { } } + if (!$host_match) { + if ($host === id(new PhutilURI($file_uri))->getDomain()) { + foreach ($cdn_routes as $route) { + if (strncmp($path, $route, strlen($route)) == 0) { + $host_match = true; + break; + } + } + } + } + // NOTE: If the base URI isn't defined yet, don't activate alternate // domains. if ($base_uri && !$host_match) {