Curl ips-v4 empty

I run a script to curl the url curl https://www.cloudflare.com/ips-v4 to grab the Cloudflare IPs and configure the firewall to only allow http access from these addresses.

This script has been working for ~year, but stopped in the past ~week.

The very strange thing is that even though curl has stopped working, a wget from the same host is still able to pull the IPs.



[[email protected] ~]# curl https://www.cloudflare.com/ips-v4
[[email protected] ~]# wget -O /dev/stdout https://www.cloudflare.com/ips-v4/
--2022-02-23 18:45:05--  https://www.cloudflare.com/ips-v4/
Resolving www.cloudflare.com (www.cloudflare.com)... 104.16.123.96, 104.16.124.96, 2606:4700::6810:7c60, ...
Connecting to www.cloudflare.com (www.cloudflare.com)|104.16.123.96|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 230 [text/plain]
Saving to: ‘/dev/stdout’

/dev/stdout                                                   0%[                                                                                                                                          ]       0  --.-KB/s               173.245.48.0/20
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
141.101.64.0/18
108.162.192.0/18
190.93.240.0/20
188.114.96.0/20
197.234.240.0/22
198.41.128.0/17
162.158.0.0/15
104.16.0.0/13
104.24.0.0/14
172.64.0.0/13
/dev/stdout                                                 100%[=========================================================================================================================================>]     230  --.-KB/s    in 0s

So everything, DNS, routing, etc is working. Strange that curl has broken though.

So

It works, but if you add the trailingslash / to the end → there is some 301 redirection :thinking:

curl https://www.cloudflare.com/ips-v4/
173.245.48.0/20
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
141.101.64.0/18
108.162.192.0/18
190.93.240.0/20
188.114.96.0/20
197.234.240.0/22
198.41.128.0/17
162.158.0.0/15
104.16.0.0/13
104.24.0.0/14
172.64.0.0/13
131.0.72.0/22
2 Likes

Hello-
Now when I run curl -v against the url https://www.cloudflare.com/ips-v4 I see the HTTP 301 message.

< HTTP/2 301
< date: Thu, 24 Feb 2022 13:55:11 GMT
< content-length: 0
< location: https://www.cloudflare.com/ips-v4/

And with the / added to the end of the URL path the curl is working again.
curl https://www.cloudflare.com/ips-v4/
173.245.48.0/20
103.21.244.0/22

Thanks,
-Jamie

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.