Skip to content

Commit 60e2aee

Browse files
its-me-maadyaudiodude
authored andcommitted
Add Cache-Control headers for CSS/JS assets (#241)
Add cache.conf to nginx config to serve CSS and JS assets with proper Cache-Control headers, allowing browsers to cache them for 1 year. Follows same pattern as existing gzip.conf. Fixes #241
1 parent 6595be3 commit 60e2aee

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docker/frontend/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ RUN yarn install && yarn run build
88
FROM nginx:stable-alpine as production-stage
99
COPY --from=build-stage /app/dist /usr/share/nginx/html
1010
COPY docker/frontend/gzip.conf /etc/nginx/conf.d/
11+
COPY docker/frontend/cache.conf /etc/nginx/conf.d/
1112
EXPOSE 80
1213
CMD ["nginx", "-g", "daemon off;"]

docker/frontend/cache.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
location ~* \.(css|js)$ {
2+
expires 1y;
3+
add_header Cache-Control "public, max-age=31536000, immutable";
4+
}

0 commit comments

Comments
 (0)