Skip to content

Commit

Permalink
Fix not serving statics - regression from #bc25920
Browse files Browse the repository at this point in the history
  • Loading branch information
porsager committed Jan 8, 2021
1 parent 1c641db commit e0533e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/serve/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ module.exports.start = function() {
corsy && corsy.on('error', error)

proxy && proxy.on('proxyRes', function(proxyRes, req, res) {
if (req.method === 'GET' && proxyRes.statusCode === 404 && req.headers.accept && req.headers.accept.includes('html')) {
if (req.method === 'GET' && proxyRes.statusCode === 404) {
return statics(req, res, () => {
req.url = '/index.html'
statics(req, res, finalhandler(req, res))
if (req.headers.accept && req.headers.accept.includes('html')) {
req.url = '/index.html'
statics(req, res, finalhandler(req, res))
} else {
res.writeHead(proxyRes.statusCode, proxyRes.headers)
proxyRes.pipe(res)
}
})
}

Expand Down

0 comments on commit e0533e5

Please sign in to comment.