gstuartj / cf-ddns.sh

A simple client for automatically updating CloudFlare DNS with your current IP address
MIT License
81 stars 35 forks source link

Turning off proxy #3

Open danartif opened 7 years ago

danartif commented 7 years ago

When running script it turns off Proxy (Turns cloud to grey) How can i stop this?

Thanks dan

gstuartj commented 7 years ago

This appears to be a bug in cf-ddns.sh. I hadn't noticed this behavior before, but it looks like if you do an update to the DNS record without specifying the proxy state, it defaults to off. I will work on a fix. Good catch!

As a quick and dirty workaround, you can change the end of line 269 to --data "{\"id\":\"${zone_id}\",\"type\":\"A\",\"name\":\"${record_name}\",\"content\":\"${WAN_addr}\", \"proxiable\":true,\"proxied\":true}"`

danartif commented 7 years ago

Brilliant, Appreciate it

Thank you

gstuartj commented 7 years ago

I did edit that comment, so make sure both "proxiable" and "proxied" are set to true in that line. Thanks for bringing this to my attention.

danartif commented 7 years ago

269 didn't work for me unless i done it wrong but what did work was just adding the proxy statements to this- tested with false and it turns proxy off, and also tested with true and it doesn't turn proxy off. (Unless you actually meant this line and the line number was wrong)

# Perform record update
api_dns_update=`${curl_command} -s -X PUT "${cf_api_url}/zones/${zone_id}/dns_records/${record_id}" -H "X-Auth-Email: ${cf_email}" -H "X-Auth-Key: ${cf_api_key}" -H "Content-Type: application/json" --data "{\"id\":\"${zone_id}\",\"type\":\"A\",\"name\":\"${record_name}\",\"content\":\"${WAN_addr}\", \"proxiable\":true,\"proxied\":true}"`