mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Remove HTTP/2 server push for Cloudflare
클플에서 해당 기능 지원 중단하여 더이상 작동하지 않음 https://developer.chrome.com/blog/removing-push/
This commit is contained in:
parent
6856f60ff9
commit
e9e46e3391
7 changed files with 0 additions and 64 deletions
|
|
@ -507,17 +507,6 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
|
||||
// Enable HTTP/2 server push for CSS resources.
|
||||
if ($finalize && $this->_isServerPushEnabled())
|
||||
{
|
||||
foreach ($result as $resource)
|
||||
{
|
||||
if ($resource['file'][0] === '/' && $resource['file'][1] !== '/')
|
||||
{
|
||||
header(sprintf('Link: <%s>; rel=preload; as=style', $resource['file']), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
@ -611,17 +600,6 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
|
||||
// Enable HTTP/2 server push for JS resources.
|
||||
if ($type === 'head' && $finalize && $this->_isServerPushEnabled())
|
||||
{
|
||||
foreach ($result as $resource)
|
||||
{
|
||||
if ($resource['file'][0] === '/' && $resource['file'][1] !== '/')
|
||||
{
|
||||
header(sprintf('Link: <%s>; rel=preload; as=script', $resource['file']), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
@ -743,29 +721,4 @@ class FrontEndFileHandler extends Handler
|
|||
$file->index += isset($cssSortList[$tmp]) ? $cssSortList[$tmp] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if server push is enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isServerPushEnabled()
|
||||
{
|
||||
if (!config('view.server_push'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
elseif (strncmp($_SERVER['SERVER_PROTOCOL'] ?? '', 'HTTP/2', 6) === 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
elseif (isset($_SERVER['HTTP_CF_VISITOR']) && \RX_SSL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue