Skip to content

Commit d9e1ee1

Browse files
authored
Cache post thumbnail (#349)
1 parent e606aee commit d9e1ee1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/Http/Controllers/PostThumbnailController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public function __invoke(Post $post)
1515
{
1616
abort_unless($post->is_published, 404);
1717

18-
return redirect()->to(
19-
path: $post->getFirstMediaUrl('thumbnail', 'thumbnail-jpg'),
20-
status: 301,
21-
);
18+
return response()
19+
->redirectTo($post->getFirstMediaUrl('thumbnail', 'thumbnail-jpg'), 301)
20+
->header('Cache-Control', 'public, max-age=31536000')
21+
->header('Vary', 'Accept');
2222
}
2323
}

0 commit comments

Comments
 (0)