🐛 Fix bug that page did load white after version update

This commit is contained in:
Jan Oberhauser 2019-09-20 13:54:06 +02:00
parent a5344a0998
commit 676cecec66

View file

@ -1129,8 +1129,19 @@ class App {
// Serve the website
const startTime = (new Date()).toUTCString();
const editorUiPath = require.resolve('n8n-editor-ui');
this.app.use('/', express.static(pathJoin(pathDirname(editorUiPath), 'dist'), { index: 'index.html' }));
this.app.use('/', express.static(pathJoin(pathDirname(editorUiPath), 'dist'), {
index: 'index.html',
setHeaders: (res, path) => {
if (res.req && res.req.url === '/index.html') {
// Set last modified date manually to n8n start time so
// that it hopefully refreshes the page when a new version
// got used
res.setHeader('Last-Modified', startTime);
}
}
}));
}
}