Skip to content

Commit

Permalink
Add Cache-Control Header on asset route
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwaadpepper committed Sep 28, 2022
1 parent c1631b8 commit df3f253
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to `CrudPolicies` will be documented in this file.

# version 0.5.1
- Changed Asset response now sends cache-control header

# version 0.5.0
- Added ESLINT
- Added STYLELINT
Expand Down
8 changes: 5 additions & 3 deletions src/Http/Controllers/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public function asset(string $type, string $fileUri)
} catch (FileNotFoundException $e) {
abort(404);
}
return response($data, 200, [
'Content-Type' => $type === 'js' ? 'text/javascript' : 'text/css'
]);
$responseArray = [
'Content-Type' => $type === 'js' ? 'text/javascript' : 'text/css',
'Cache-Control' => 'private, max-age=86400'
];
return response($data, 200, $responseArray);
}
}

0 comments on commit df3f253

Please sign in to comment.