@vercel/microfrontends 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1672,17 +1672,18 @@ function transform4(args) {
1672
1672
  if (requireLocalProxyHeader) {
1673
1673
  const proxyRedirects = [
1674
1674
  {
1675
- source: "/:path*",
1675
+ source: `/:path*`,
1676
1676
  destination: `http://localhost:${microfrontend.getLocalProxyPort()}/:path*`,
1677
1677
  permanent: false,
1678
1678
  missing: [
1679
- { type: "header", key: "x-vercel-mfe-local-proxy-origin" },
1680
- {
1681
- type: "host",
1682
- value: `localhost:${microfrontend.getLocalProxyPort()}`
1683
- // if it's already on the host, we don't need to redirect
1684
- }
1685
- ]
1679
+ { type: "header", key: "x-vercel-mfe-local-proxy-origin" }
1680
+ ],
1681
+ // this fixes relative path Next.js images locally. A security fix removed the headers from the image request,
1682
+ // https://github.com/vercel/next.js/pull/82114, and locally the image fetch does not follow redirects. This
1683
+ // means the header x-vercel-mfe-local-proxy-origin is stripped, and the redirect to then add the header back
1684
+ // in is not followed. As all headers are stripped, there is also no host header, so this check will ensure
1685
+ // relative path Next.js images are not redirected to the local proxy.
1686
+ has: [{ type: "header", key: "host" }]
1686
1687
  }
1687
1688
  ];
1688
1689
  if (next.redirects && typeof next.redirects === "function") {