From 9a79a6ff7fd4fa5945193ddb217c09a7b6c6c6d9 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 18 Aug 2018 22:17:28 -0700 Subject: [PATCH] disable manifest.json for iOS (#441) fixes #45 --- server.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server.js b/server.js index e072ce1b..7dd8c6c9 100644 --- a/server.js +++ b/server.js @@ -48,6 +48,17 @@ app.use(nonDebugOnly(helmet({ } }))) +// TODO: remove this hack when Safari works with cross-origin window.open() +// in a PWA: https://github.com/nolanlawson/pinafore/issues/45 +app.get('/manifest.json', (req, res, next) => { + if (/iP(?:hone|ad|od)/.test(req.headers['user-agent'])) { + return res.status(404).send({ + error: 'manifest.json is disabled for iOS. see https://github.com/nolanlawson/pinafore/issues/45' + }) + } + return next() +}) + app.use(serveStatic('assets', { setHeaders: (res) => { res.setHeader('Cache-Control', 'public,max-age=600')