Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cloud-function): use URL.pathname to resolve index.html only #11271

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Jun 7, 2024

Summary

Fixes #11270, a regression caused by #9655.

Problem

When migrating from url.parse() to new URL(), we accidentally started adding req.protocol and req.headers.host to the resolved URL.

Solution

Use the resolved pathname without protocol/host/search/hash.


Screenshots

Before

curl -I http://localhost:5100/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_compatibility_for_manifest.json
HTTP/1.1 404 Not Found

After

curl -I http://localhost:5100/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_compatibility_for_manifest.json
HTTP/1.1 200 Not Found

How did you test this change?

Ran npm start in /cloud-function, and curl -I http://localhost:5100/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_compatibility_for_manifest.json separately.

When migrating from `url.parse()` to `new URL()`, we accidentally
started adding `req.protocol` and `req.headers.host` to the resolved URL.
@caugner caugner requested a review from a team as a code owner June 7, 2024 12:45
@caugner
Copy link
Contributor Author

caugner commented Jun 7, 2024

@caugner caugner merged commit 102682a into main Jun 7, 2024
12 checks passed
@caugner caugner deleted the 11270-fix-resolving-index-html branch June 7, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Page URLs ending with .json don't show up
2 participants