Receiving error via bash but browser works

Anthony Bikowski 0 Reputation points
2023-08-20T13:32:51.7666667+00:00

When running this command on bash curl --connect-timeout 5 http://$IPADDRESS (Yes, I changed it to my ip address of web server) it recieves the error in bash but is accessible and works fine in browser:

curl: (28) Failed to connect to 4.42.115.23 port 80 after 5000 ms: Timeout was reached

Is there something I am doing wrong?

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
2,359 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Marian Dumitru Danci 0 Reputation points
    2023-08-20T14:45:36.76+00:00

    Observe the headers your browser sends when making a request, and then include those same headers in your "curl" request. Certain servers require specific headers that browsers send by default, which might not be included in your "curl" request.

    You can see the headers send by inspecting the network activity. You can follow this guide for Chrome: https://developer.chrome.com/docs/devtools/network/

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.