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(peers): chrome regression and update ipfs-geoip to v9.2 #2333

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"intl-messageformat": "^10.3.3",
"ip": "^1.1.9",
"ipfs-css": "^1.4.0",
"ipfs-geoip": "^9.1.0",
"ipfs-geoip": "^9.2.0",
"ipfs-provider": "^2.1.0",
"ipld-explorer-components": "^8.1.3",
"is-ipfs": "^8.0.1",
Expand Down
4 changes: 4 additions & 0 deletions src/bundles/peer-locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ class PeerLocationResolver {
async findLocations (gatewayUrls, peers) {
const res = {}

// Normalize Gateway URLS:
// switch localhost to raw IP to avoid subdomain redirect AND avoid Chrome forcing https:// on such redirect
gatewayUrls = (Array.isArray(gatewayUrls) ? gatewayUrls : [gatewayUrls]).map(url => url.replace(/localhost:(\d+)/, '127.0.0.1:$1'))
Comment on lines +237 to +239
Copy link
Member Author

@lidel lidel Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ At some point Chrome started normalizing HTTP 301 to use https:// instead of http://, even if the origin is localhost. This broke Flags on Peers screen, but we did not notice because most of flags were locally cached in IndexDB and was not immediately obvious it stopped working.

@SgtPooki (just FYI) this PR includes a localized fix for flags on Peers screen but may be useful to know about the bug if it surfaces elsewhere.


for (const p of this.optimizedPeerSet(peers)) {
const peerId = p.peer

Expand Down
Loading