disable manifest.json for iOS (#441)

fixes #45
This commit is contained in:
Nolan Lawson 2018-08-18 22:17:28 -07:00 committed by GitHub
parent a1b89805e7
commit 9a79a6ff7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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')