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

Fixed issue with ifconfig.co #1066

Merged

Conversation

starek4
Copy link
Contributor

@starek4 starek4 commented Nov 30, 2022

Hi all,

I am using this script on some VMs in Azure. It worked quite well for a while but stopped working yesterday. The issue is that when obtaining the public IP address, the https://ifconfig.co is now behind the Cloudfare, so the CURL request to it fails with HTTP code 503 and in response is this HTML instead of an IP address:
image

This PR comes with a fallback, whenever the https://ifconfig.co will not be useable for any reason, it will utilize the Google DNS service for those purposes.

I have tested it on Azure VMs and locally and it is working just fine.

@starek4 starek4 mentioned this pull request Nov 30, 2022
4 tasks
@angristan
Copy link
Owner

Thanks for this!

How about replacing ifconfig entirely by the dig call?

@starek4
Copy link
Contributor Author

starek4 commented Jan 3, 2023

I would not replace it entirely, it can also fail in some circumstances, let's use it as a fallback.

@angristan angristan merged commit 4ee44c8 into angristan:master Jan 6, 2023
@starek4 starek4 deleted the public-ip-address-resolution-fix branch January 7, 2023 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants