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

https://1.1.1.1/cdn-cgi/trace is down and script tries to update the records with HTML code of the error page #202

Open
a-reda opened this issue Nov 20, 2024 · 4 comments
Assignees

Comments

@a-reda
Copy link

a-reda commented Nov 20, 2024

Describe the bug
Main script fails to determine current IP address as https://1.1.1.1/cdn-cgi/trace is down and therefore fails to update Cloudflare's records

Probably adding a check that and IPv4 Ip has been returned is worth it before trying to update Cloudlfare's records (instead of using HTML response)

To Reproduce
Logs showing the failed IP request and tries to update Cloudflare's records with HTML code of the error page

🧩 IPv4 not detected via 1.1.1.1, trying 1.0.0.1
🧩 IPv4 not detected via 1.0.0.1. Verify your ISP or DNS provider isn't blocking Cloudflare's IPs.
🗑️  Deleted stale record record-id
➕ Adding new record {'type': 'A', 'name': 'NAME 'content': ['<!DOCTYPE html>', '<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->', '<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->', '<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->', '<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->', 
...
😡 Error sending 'POST' request to 'https://api.cloudflare.com/client/v4/zones/recors-id/dns_records':
{"result":null,"success":false,"errors":[{"code":9207,"message":"Request body is invalid."}],"messages":[]}

Currently using the following work around to determine the adress

 a = requests.get("https://ifconfig.co/json").json()['ip']

Expected behavior
Should determine IP address correctly and update records accordingly

Screenshots
Current error in https://1.1.1.1/cdn-cgi/trace
cld

@a-reda
Copy link
Author

a-reda commented Nov 21, 2024

https://1.1.1.1/cdn-cgi/trace is back up again.

It could still be worth having a response validation and a fallback system.

@irfanhakim-as
Copy link

irfanhakim-as commented Nov 25, 2024

Getting the same logs, and as of right now https://1.1.1.1/cdn-cgi/trace seems to be down again returning the same error code.

🧩 IPv4 not detected via 1.1.1.1, trying 1.0.0.1
🧩 IPv4 not detected via 1.0.0.1. Verify your ISP or DNS provider isn't blocking Cloudflare's IPs.
📡 Updating record {'type': 'A', 'name': 'NAME', 'content': ['<!DOCTYPE html>', '<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->', '<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US">
😡 Error sending 'PUT' request to 'https://api.cloudflare.com/client/v4/zones/x/dns_records/x':
{"result":null,"success":false,"errors":[{"code":9207,"message":"Request body is invalid."}],"messages":[]}

@irfanhakim-as
Copy link

irfanhakim-as commented Nov 26, 2024

I think I may have fixed this issue, as described in my PR, in case anyone needs it :)

PR: #203

🧩 IPv4 not detected via 1.1.1.1, trying ipv4.icanhazip.com
➕ Adding new record {'type': 'A', 'name': 'NAME', 'content': 'x.x.x.x', 'proxied': True, 'ttl': 300}

@AverageHelper
Copy link

AverageHelper commented Dec 3, 2024

It's strange how https://1.1.1.1/cdn-cgi/trace works when I'm on a VPN, but fails with Error 1034 otherwise. Like, do they block specific IPs that happen to be in my ISP's rotation or something?

EDIT: I only noticed this issue this morning, when my IP got reassigned per the usual schedule.

EDIT2: That endpoint works against other edge services, so it's just 1.1.1.1? I'm confused 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants