Skip to content

Commit

Permalink
Fix proxy forwarding correct status
Browse files Browse the repository at this point in the history
  • Loading branch information
porsager committed May 12, 2020
1 parent 1f9932b commit 26e45d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/serve/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ module.exports.start = function() {
proxy && proxy.on('proxyRes', function(proxyRes, req, res) {
if (req.method === 'GET', proxyRes.statusCode === 404) {
return statics(req, res, () => {
req.url = '/index.html'
req.url = '/index.html'
statics(req, res, finalhandler(req, res))
})
}

res.writeHead(res.statusCode, proxyRes.headers)
res.writeHead(proxyRes.statusCode, proxyRes.headers)
proxyRes.pipe(res)
})

function error(err, req, res) {
log.error(err)
if (res.writeHead) {
res.writeHead(500, { 'Content-Type': 'text/plain' })
res.end(String(err))
res.writeHead(500, { 'Content-Type': 'text/plain' })
res.end(String(err))
} else {
res.destroy()
}
Expand Down

0 comments on commit 26e45d4

Please sign in to comment.