Skip to content

Commit

Permalink
fix(peers): chrome regression and update ipfs-geoip to v9.2 (#2333)
Browse files Browse the repository at this point in the history
* fix: update ipfs-geoip to v9.2

https://github.com/ipfs-shipyard/ipfs-geoip/releases/tag/v9.2.0

* fix(peers): avoid HTTP 301 on localhost

?format=raw does not benefit from origin isolation,
bu switching to raw IP we use path gateway and return payload
immediatelly + avoid issue with chrome upgrading to https://
  • Loading branch information
lidel authored Feb 24, 2025
1 parent 412b89f commit 699f735
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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'))

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

Expand Down

0 comments on commit 699f735

Please sign in to comment.