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

http://api.ipify.org/ doesn't support ipv6 #47566

Open
5 tasks done
sybrew opened this issue May 16, 2024 · 2 comments
Open
5 tasks done

http://api.ipify.org/ doesn't support ipv6 #47566

sybrew opened this issue May 16, 2024 · 2 comments
Labels
focus: settings Issues related to managing settings. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: Proton type: community contribution

Comments

@sybrew
Copy link

sybrew commented May 16, 2024

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

In WC_Geolocation::$ip_lookup_apis, various APIs are appointed to obtain the host's IP address. Unlike all other IPs, ipify doesn't support IPv6, which may cause a headache when debugging lookups.

This is likely inconsequential, but it may also trickle down into executing multiplicable geolocation lookups via WC_Geolocation::geolocate_ip().

Expected behavior

Consistent IPv6 and IPv4 support across the board.

Actual behavior

Inconsistent IPv6 and IPv4 support.

Steps to reproduce

Run this on a server with mixed IPv6 and IPv4 support. It will crash if the site is unreachable, but eh... it's for testing purposes.

add_action(
	'init',
	function () {
		var_dump( wp_safe_remote_get(
			'http://api.ipify.org/', // change to test other endpoints.
			[
				'timeout'    => 2,
				'user-agent' => 'WooCommerce/' . wc()->version,
			],
		)['body'] );
	},
);

WordPress Environment

N/A

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.
@tammullen tammullen added focus: settings Issues related to managing settings. team: Proton labels May 17, 2024
@naman03malhotra
Copy link
Contributor

Hi @sybrew, we'd still want to support ipify, as long as it's not in a critical path and does not cause site to crash. Do you see this happening on a server without the code snippet?

@sybrew
Copy link
Author

sybrew commented May 21, 2024

The snippet serves as an example and is not indicative of the real world performance. Still, it proves that, unlike all other providers, IPv6 is not supported and will cause unnecessary calls since it bypasses the cache.

@naman03malhotra naman03malhotra added the priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: settings Issues related to managing settings. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: Proton type: community contribution
Projects
None yet
Development

No branches or pull requests

3 participants