Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

p2p: Fix public IP hack for browser environments #359

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

albrow
Copy link
Contributor

@albrow albrow commented Aug 14, 2019

https://ifconfig.me responds with different results depending on the value of the User-Agent header. For browser environments, it responds with HTML and for non-browser environments it responds with your IP address in plain text. Adding /ip to the URL results in the same behavior regardless of user agent.

@albrow albrow added the browser label Aug 14, 2019
@albrow albrow added this to the Browser Support milestone Aug 14, 2019
@albrow albrow changed the title Fix public IP hack for browser environments p2p: Fix public IP hack for browser environments Aug 15, 2019
@fabioberger
Copy link
Contributor

@albrow does this return a sensible, usable response? If not, why not just skip this step if in the browser?

@albrow
Copy link
Contributor Author

albrow commented Aug 15, 2019

does this return a sensible, usable response? If not, why not just skip this step if in the browser?

Good point; probably not. It might be useful for WebRTC connections but I think the ICE process is already designed to do this.

Nonetheless we should still use the url with the /ip suffix. It's more reliable and doesn't depend on your User-Agent (which could still change slightly for different platforms even for non-browser peers).

@albrow albrow merged commit 1b8bd9b into development Aug 15, 2019
@albrow albrow deleted the fix/ip-hack-for-browsers branch August 15, 2019 19:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants