Skip to content

Commit

Permalink
Merge pull request #1146 from nextstrain/caching-settings
Browse files Browse the repository at this point in the history
Caching settings
  • Loading branch information
jameshadfield authored Jun 2, 2020
2 parents 074f13b + 3a795d1 commit 290e482
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cli/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ const run = (args) => {
utils.verbose(`Serving index / favicon etc from "${auspiceBuild.baseDir}"`);
utils.verbose(`Serving built javascript from "${auspiceBuild.distDir}"`);
app.get("/favicon.png", (req, res) => {res.sendFile(path.join(auspiceBuild.baseDir, "favicon.png"));});
app.use("/dist", expressStaticGzip(auspiceBuild.distDir));
app.use(express.static(auspiceBuild.distDir));
app.use("/dist", expressStaticGzip(auspiceBuild.distDir, {maxAge: '30d'}));

let handlerMsg = "";
if (args.gh_pages) {
Expand All @@ -125,7 +124,7 @@ const run = (args) => {

/* this must be the last "get" handler, else the "*" swallows all other requests */
app.get("*", (req, res) => {
res.sendFile(path.join(auspiceBuild.baseDir, "dist/index.html"));
res.sendFile(path.join(auspiceBuild.baseDir, "dist/index.html"), {headers: {"Cache-Control": "no-cache, no-store, must-revalidate"}});
});

const server = app.listen(app.get('port'), app.get('host'), () => {
Expand Down

0 comments on commit 290e482

Please sign in to comment.