Skip to content

Commit

Permalink
fix(cloud-function): use URL.pathname to resolve index.html only (#11271
Browse files Browse the repository at this point in the history
)

When migrating from `url.parse()` to `new URL()`, we accidentally
started adding `req.protocol` and `req.headers.host` to the resolved URL.
  • Loading branch information
caugner committed Jun 7, 2024
1 parent 4923e00 commit 102682a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cloud-function/src/middlewares/resolve-index-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export async function resolveIndexHTML(
if (!isAsset(pathname)) {
pathname = path.join(pathname, "index.html");
}
urlParsed.pathname = pathname;
req.url = urlParsed.toString();
req.url = pathname; // e.g. "/en-us/docs/mozilla/add-ons/webextensions/browser_compatibility_for_manifest.json"
// Workaround for http-proxy-middleware v2 using `req.originalUrl`.
// See: https://github.com/chimurai/http-proxy-middleware/pull/731
req.originalUrl = req.url;
Expand Down

0 comments on commit 102682a

Please sign in to comment.