Skip to content

Commit 53a3595

Browse files
committed
feat: nginx and font caching
1 parent ef14378 commit 53a3595

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

docker/etc/nginx/conf.d/default.conf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,20 @@ server {
5353

5454
location /storage/ {
5555
location /storage/thumbnails/ {
56+
add_header Cache-Control "public, max-age=604800, must-revalidate";
57+
try_files $uri =404;
5658
allow all;
5759
}
5860

5961
location /storage/posters/ {
62+
add_header Cache-Control "public, max-age=604800, must-revalidate";
63+
try_files $uri =404;
6064
allow all;
6165
}
6266

6367
location /storage/previews/ {
68+
add_header Cache-Control "public, max-age=604800, must-revalidate";
69+
try_files $uri =404;
6470
allow all;
6571
}
6672

@@ -69,4 +75,14 @@ server {
6975
return 403;
7076
}
7177
}
78+
79+
location ~* \.(?:css|js|woff2?|ttf|eot|otf)$ {
80+
add_header Cache-Control "public, max-age=604800, must-revalidate";
81+
try_files $uri =404;
82+
}
83+
84+
location ~* \.(?:ico|jpg|jpeg|png|gif|webp|svg)$ {
85+
add_header Cache-Control "public, max-age=604800, must-revalidate";
86+
try_files $uri =404;
87+
}
7288
}

resources/views/layouts/app.blade.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ function setVhUnit() {
2424
window.addEventListener('resize', setVhUnit)
2525
</script>
2626

27+
<link rel="preconnect" href="https://fonts.googleapis.com">
28+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
29+
2730
<!-- local -->
2831
@vite('resources/css/app.css')
2932
<style>

0 commit comments

Comments
 (0)