Skip to content

Commit

Permalink
frontend: optimize the cache settings so that the assets are aggressi…
Browse files Browse the repository at this point in the history
…vely cached.

Signed-off-by: Hiram Chirino <[email protected]>
  • Loading branch information
chirino committed Feb 16, 2024
1 parent 7c98b91 commit 8478f0c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions ui/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
server {
listen 3000;
listen 3000;

location / {
root /usr/share/nginx/html/;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
}
# all assets contain hash in filename, cache forever
location /assets/ {
root /usr/share/nginx/html/;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
add_header Cache-Control "public, immutable, max-age=31536000, s-maxage=31536000";
}

location / {
root /usr/share/nginx/html/;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
add_header Cache-Control "public";
}
}

0 comments on commit 8478f0c

Please sign in to comment.