diff options
Diffstat (limited to 'src/Http/Controllers')
-rw-r--r-- | src/Http/Controllers/SvgController.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Http/Controllers/SvgController.php b/src/Http/Controllers/SvgController.php index 9e9c550..a29fce1 100644 --- a/src/Http/Controllers/SvgController.php +++ b/src/Http/Controllers/SvgController.php @@ -18,11 +18,20 @@ class SvgController extends Controller $svgContent = $collection->getSvg(); if ($svgContent === null) abort(404); + $cacheControl = ''; + if ($request->query('v') && ($maxAge = $collection->getMaxAge()) > 0) { + $cacheControl = "max-age={$maxAge}, public"; + } + else { + $cacheControl = 'no-store, private'; + } + return response( $svgContent, 200, [ 'Content-Type' => 'image/svg+xml', + 'Cache-Control' => $cacheControl, ] ); } |