Skip to content

Commit

Permalink
Update router.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Nov 19, 2024
1 parent 9c96a60 commit dcf8954
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resources/server/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@
foreach ($pathInfo['headers'] as $header) {
header($header);
}
// custom headers
// custom headers based on path
$headersFile = $_SERVER['DOCUMENT_ROOT'] . '/../' . SERVER_TMP_DIR . '/headers.ini';
if (file_exists($headersFile)) {
$headersArray = parse_ini_file($headersFile, true);
// joker path
// joker path tree
$pathParts = explode('/', pathinfo($path, PATHINFO_DIRNAME));
$previous = '';
for ($i = 0; $i < \count($pathParts); $i++) {
Expand All @@ -160,7 +160,7 @@
break;
}
}
// file path
// exact file path
if (\array_key_exists($path, $headersArray)) {
foreach ($headersArray[$path] as $key => $value) {
header("$key: " . $value);
Expand Down

0 comments on commit dcf8954

Please sign in to comment.