fix: proxy status code

This commit is contained in:
cha0s 2021-02-03 11:10:51 -06:00
parent a2c5c21c44
commit 768098b513

View File

@ -60,6 +60,7 @@ export const createHttpServer = async (latus) => {
target: `http://127.0.0.1:${devPort}`, target: `http://127.0.0.1:${devPort}`,
}); });
proxy.on('proxyRes', async (proxyRes, req, res) => { proxy.on('proxyRes', async (proxyRes, req, res) => {
res.statusCode = proxyRes.statusCode;
if ('text/html; charset=UTF-8' === proxyRes.headers['content-type']) { if ('text/html; charset=UTF-8' === proxyRes.headers['content-type']) {
requestMiddleware(req, res, () => { requestMiddleware(req, res, () => {
res.setHeader('Content-Type', proxyRes.headers['content-type']); res.setHeader('Content-Type', proxyRes.headers['content-type']);