diff --git a/.changeset/quiet-local-proxy-urls.md b/.changeset/quiet-local-proxy-urls.md new file mode 100644 index 0000000..1796a6f --- /dev/null +++ b/.changeset/quiet-local-proxy-urls.md @@ -0,0 +1,5 @@ +--- +'@vercel/microfrontends': patch +--- + +Avoid Node.js `url.parse()` deprecation warnings when routing requests through the local proxy. diff --git a/packages/microfrontends/src/bin/local-proxy.test.ts b/packages/microfrontends/src/bin/local-proxy.test.ts index 219375a..a8028d1 100644 --- a/packages/microfrontends/src/bin/local-proxy.test.ts +++ b/packages/microfrontends/src/bin/local-proxy.test.ts @@ -740,6 +740,7 @@ describe('class LocalProxy', () => { expect.anything(), res, expect.objectContaining({ + toProxy: true, headers: expect.objectContaining({ 'x-forwarded-proto': 'https', 'x-forwarded-host': 'vercel.localhost', @@ -1097,6 +1098,7 @@ describe('class LocalProxy', () => { socket, head, expect.objectContaining({ + toProxy: true, headers: expect.objectContaining({ 'x-forwarded-proto': 'https', 'x-forwarded-host': 'vercel.localhost', diff --git a/packages/microfrontends/src/bin/local-proxy.ts b/packages/microfrontends/src/bin/local-proxy.ts index 73f11c1..cf243ea 100644 --- a/packages/microfrontends/src/bin/local-proxy.ts +++ b/packages/microfrontends/src/bin/local-proxy.ts @@ -739,6 +739,9 @@ export class LocalProxy { this.proxy.ws(req, socket, head, { target: target.url, headers, + // Forward the origin-form request target directly instead of letting + // http-proxy parse it with Node.js's deprecated url.parse(). + toProxy: true, }); } catch (err) { logger.error('Error proxying ws: ', err); @@ -927,6 +930,9 @@ export class LocalProxy { this.proxy.web(strippedReq, res, { target: target.url, headers, + // Forward the origin-form request target directly instead of letting + // http-proxy parse it with Node.js's deprecated url.parse(). + toProxy: true, }); } }