Unverified Commit 1619a6a5 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update server invoke-request (#50296)

Follow-up to https://github.com/vercel/next.js/pull/50293 we can now
avoid this normalizing which isn't as reliable as being able to rely on
`localhost` directly since we can't assume it maps to `127.0.0.1`
always.

x-ref:
https://github.com/vercel/next.js/actions/runs/5072034311/jobs/9109241689
parent 47546ddc
...@@ -9,13 +9,6 @@ export const invokeRequest = async ( ...@@ -9,13 +9,6 @@ export const invokeRequest = async (
}, },
readableBody?: import('stream').Readable readableBody?: import('stream').Readable
) => { ) => {
const parsedUrl = new URL(targetUrl)
// force localhost to IPv4 as some DNS may
// resolve to IPv6 instead
if (parsedUrl.hostname === 'localhost') {
parsedUrl.hostname = '127.0.0.1'
}
const invokeHeaders = filterReqHeaders({ const invokeHeaders = filterReqHeaders({
...requestInit.headers, ...requestInit.headers,
}) as IncomingMessage['headers'] }) as IncomingMessage['headers']
...@@ -26,7 +19,7 @@ export const invokeRequest = async ( ...@@ -26,7 +19,7 @@ export const invokeRequest = async (
try { try {
const invokeReq = http.request( const invokeReq = http.request(
parsedUrl.toString(), targetUrl,
{ {
headers: invokeHeaders, headers: invokeHeaders,
method: requestInit.method, method: requestInit.method,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment