Fixed get_public_ip method for handling proxies correctly