0

Tldr;

From my home network on a (MacOS Venture 13.4): curl https://ifconfig.me works but curl ifconfig.me or curl http://ifconfig.me not working. When connecting to other networks both work fine. Is there any way to debug the issue? why it's not working in the latter case?

Long read:

I'm trying to access curl ifconfig.me to return the ip address. It was working fine previously but for the last 1-2 months it returns:

connect to 34.160.111.145 port 80 failed: Operation timed out
* Failed to connect to ifconfig.me port 80 after 75065 ms: Couldn't connect to server
* Closing connection 0

When I tried with curl https://ifconfig.me, it returns the IP address. While doing verbose it clearly says it trying to connect port 443.

This issue only happens when I try to connect with my home network. When I connect to other networks, curl ifconfig returns a value.

When I use WARP by Cloudflare it works fine. So maybe a DNS issue.

How can I debug this issue? How can I get more details on how/why the port is connecting to 80 (HTTP)?

I'm using MacOS Venture 13.4.

6
  • both port 80 and 443 work fine from here, and both connect to the right IP address for that domain - the problem is most likely at your end Commented Jun 13, 2023 at 3:19
  • 1
    I'd guess that maybe the OP's ISP is blocking port 80, maybe to force users to use their proxy. Alternatively, the OP may have mis-configured firewall rules on their system (or their router/modem/whatever they're using to connect to their ISP)
    – cas
    Commented Jun 13, 2023 at 3:23
  • curl with http and https protocol works perfectly fine for me. But in my home network when try to do curl without protocol it's not working (trying to connect 80). But when I switch to my mobile network or other networks, it's working fine without protocol
    – Anand Prem
    Commented Jun 13, 2023 at 3:33
  • yes, port 80 is being blocked by something (maybe your ISP, your host's or router's or modem's firewall rules, whatever). port 443 is not being blocked. BTW, this is definitely not a DNS issue, ifconfig.me is being correctly resolved as 34.160.111.145. You need to figure out what's doing the blocking and fix that.
    – cas
    Commented Jun 13, 2023 at 4:00
  • If you're saying that curl http://ifconfig.me works but curl ifconfig.me doesn't (times-out), please add that information to your question as that would be an important one. Anything in the output of env | grep -i proxy? Commented Jun 13, 2023 at 6:19

1 Answer 1

0

curl uses http by default, if the protocol isn't specified with the URL.

Use curl's --proto-default option if you want to override that, e.g.

curl --proto-default https ifconfig.me

or just specify the proto with the URL:

curl https://ifconfig
1
  • It will work. I agree. But when I connect to different network it works even without providing the protocol
    – Anand Prem
    Commented Jun 13, 2023 at 3:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .