diff --git a/spec/file_caching_test.js b/spec/file_caching_test.js index 71c79814f8c04d47ef2c59bdc3777f9cfc7887d8..c9004fb65f060ed15d1d999ee334e2636dba4ee8 100644 --- a/spec/file_caching_test.js +++ b/spec/file_caching_test.js @@ -76,6 +76,13 @@ describe('File caching service', function () { expect(response.text).to.equal('<html><head></head><body>it\'s me</body></html>') }) + it('serves /ui as index.html', async function () { + const response = await request(app).get('/ui') + expect(response.statusCode).to.equal(200) + expect(response.headers['content-type']).to.equal('text/html') + expect(response.text).to.equal('<html><head></head><body>it\'s me</body></html>') + }) + it('adds / to dependencies', async function () { const response = await request(app).get('/dependencies') expect(response.statusCode).to.equal(200) diff --git a/src/createApp.js b/src/createApp.js index 9ca9690c6c12ad34e82c4b872549e9f95a3a6e2a..7e9434e4bfb6ee93310ad24c92ef1b468e70e9c4 100644 --- a/src/createApp.js +++ b/src/createApp.js @@ -111,6 +111,15 @@ export function createApp () { next() }) + // backwards compatibility for 7.10.x + // this should hopefully be resolved with an ingress + // or proper config. But is used to be safe on all ends + app.get('/ui', async (req, res, next) => { + const { 'content-type': contentType, content } = fileCache.get('/index.html') + if (content) return res.setHeader('content-type', contentType).status(200).send(content) + next() + }) + app.post('/redirect', (req, res, next) => { const location = req.body.location || '../busy.html' res.redirect(location)