mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This updates the Node.js version check for proxying when running against a deployment. Fixes: https://github.com/vercel/next.js/actions/runs/3501049844/jobs/5864420602
29 lines
626 B
JavaScript
29 lines
626 B
JavaScript
import request from 'request'
|
|
|
|
export const config = {
|
|
api: {
|
|
bodyParser: false,
|
|
},
|
|
}
|
|
|
|
export default function handler(req, res) {
|
|
return req
|
|
.pipe(
|
|
request(
|
|
`http://${
|
|
// node v18 resolves to IPv6 by default so force IPv4
|
|
process.version.startsWith('v18.') && !process.env.VERCEL_URL
|
|
? `127.0.0.1:${req.headers.host.split(':').pop() || ''}`
|
|
: req.headers.host
|
|
}${req.url}/post`,
|
|
{
|
|
followAllRedirects: false,
|
|
followRedirect: false,
|
|
gzip: true,
|
|
json: false,
|
|
}
|
|
)
|
|
)
|
|
.pipe(res)
|
|
}
|