File size: 490 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import httpProxy from 'http-proxy'
export default async function handler(req, res) {
const port = req.headers.host.split(':').pop()
const proxy = httpProxy.createProxy({
target: `http://127.0.0.1:${port}/${
req.query.buildId
? `_next/static/${req.query.buildId}/_ssgManifest.js`
: `user`
}`,
ignorePath: true,
})
await new Promise((resolve, reject) => {
proxy.on('error', reject)
proxy.on('close', resolve)
proxy.web(req, res)
})
}
|