chore(*): remove duplicate cache rule + cleanup cache headers; cleanup + formatting
This commit is contained in:
parent
425fed6ff6
commit
0e565970a5
42 changed files with 223 additions and 217 deletions
|
@ -18,7 +18,6 @@ class QueryHandler extends BaseHandler
|
|||
$allowedHosts = ['coryd.dev', 'www.coryd.dev', 'localhost'];
|
||||
$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
|
||||
$referer = $_SERVER['HTTP_REFERER'] ?? '';
|
||||
|
||||
$hostAllowed = fn($url) => in_array(parse_url($url, PHP_URL_HOST), $allowedHosts, true);
|
||||
|
||||
if (!$hostAllowed($origin) && !$hostAllowed($referer)) $this->sendErrorResponse("Forbidden — invalid origin", 403);
|
||||
|
@ -44,6 +43,7 @@ class QueryHandler extends BaseHandler
|
|||
|
||||
if ($this->cache) {
|
||||
$cached = $this->cache->get($cacheKey);
|
||||
|
||||
if ($cached) {
|
||||
header('Content-Type: application/json');
|
||||
echo $cached;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue