Skip to content

Commit

Permalink
Merge pull request #6199 from GCTC-NTGC/bug-6194-config-caching
Browse files Browse the repository at this point in the history
Bug - 6194 - limit cache of config.js
  • Loading branch information
vd1992 authored and tristan-orourke committed Apr 12, 2023
1 parent 0f47e88 commit c596ace
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
data-h2-background="base(background)"
data-h2-font-family="base(sans)"
></div>
<script src="<%= htmlWebpackPlugin.files.publicPath %>config.js"></script>
<script src="<%= htmlWebpackPlugin.files.publicPath %>config.js?cache-bust=1"></script>
<noscript
>It looks like JavaScript is disabled in your browser settings or
unsupported by the browser itself. JavaScript is required to view this
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/conf/nginx-conf-deploy/default
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ server {
rewrite "^(?:/[a-z]{2})?/?$" /apps/web/dist/index.html break;
}

# find the web config in the writable home root
# find the web config in the writable home root, limit cache
location = /config.js {
alias /home/site/config-web.js;
add_header Cache-Control "public, max-age=60";
}

# rewrite tc-report static files to "tc-report/_site"
Expand Down
6 changes: 6 additions & 0 deletions infrastructure/conf/nginx-conf-local/default
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ server {
rewrite "^(?:/[a-z]{2})?/?$" /apps/web/dist/index.html break;
}

# limit cache
location = /config.js {
alias /home/site/wwwroot/apps/web/dist/config.js;
add_header Cache-Control "public, max-age=60";
}

# rewrite tc-report static files to "tc-report/_site"
location ~ "^/tc-report/(.*\.(png|ico|gif|jpg|jpeg|svg|css|js|pdf|doc|docx|map|webmanifest))$" {
rewrite "^/tc-report/(.*\.(png|ico|gif|jpg|jpeg|svg|css|js|pdf|doc|docx|map|webmanifest))$" /tc-report/_site/$1 break;
Expand Down

0 comments on commit c596ace

Please sign in to comment.