Merge pull request #2985 from nextcloud/fix-trusted-domain-error

Allow access to CSS resources
This commit is contained in:
Lukas Reschke 2017-01-09 16:29:09 +01:00 committed by GitHub
commit 05d27ec148
1 changed files with 16 additions and 8 deletions

View File

@ -791,23 +791,31 @@ class OC {
&& !\OC::$server->getTrustedDomainHelper()->isTrustedDomain($host) && !\OC::$server->getTrustedDomainHelper()->isTrustedDomain($host)
&& self::$server->getConfig()->getSystemValue('installed', false) && self::$server->getConfig()->getSystemValue('installed', false)
) { ) {
header('HTTP/1.1 400 Bad Request'); // Allow access to CSS resources
header('Status: 400 Bad Request'); $isScssRequest = false;
if(strpos($request->getPathInfo(), '/css/') === 0) {
$isScssRequest = true;
}
\OC::$server->getLogger()->warning( if (!$isScssRequest) {
header('HTTP/1.1 400 Bad Request');
header('Status: 400 Bad Request');
\OC::$server->getLogger()->warning(
'Trusted domain error. "{remoteAddress}" tried to access using "{host}" as host.', 'Trusted domain error. "{remoteAddress}" tried to access using "{host}" as host.',
[ [
'app' => 'core', 'app' => 'core',
'remoteAddress' => $request->getRemoteAddress(), 'remoteAddress' => $request->getRemoteAddress(),
'host' => $host, 'host' => $host,
] ]
); );
$tmpl = new OCP\Template('core', 'untrustedDomain', 'guest'); $tmpl = new OCP\Template('core', 'untrustedDomain', 'guest');
$tmpl->assign('domain', $host); $tmpl->assign('domain', $host);
$tmpl->printPage(); $tmpl->printPage();
exit(); exit();
}
} }
\OC::$server->getEventLogger()->end('boot'); \OC::$server->getEventLogger()->end('boot');
} }