The CURL is a great tool to troubleshoot applications against connectivity issues. It also has the ability to download files based on the specified endpoint from the Internet; For our purposes, we will focus on troubleshooting.
- Run CURL against Web Application Domain
- Run CURL against web services and databases the web application uses
Steps 1 and 2 will tell us where the root problem is. If we fail on step 1, but succeed with step 2, we know that most likely there is an issue with either 1) The Web Application 2) Domain name server look up process.
If the issue lies within the web application, then inspecting the domain controllers will help us determine the cause.
If we determine the issue to be in the domain name server look up process, we may need to revisit the DNS configurations and ensure that our domain has been registered properly with a name server that will be able to route traffic to our web application.
Common CURL Options
The two CURL command options we will be using today are -I (as in uppercase i) and -s. The -I option will enable displaying header response information while -s will silence the response body. This will allow us to focus on the HTTP response status code to determine our root cause.
Command Usage Example
- curl -I -s my-website.com
- cur -I -s my-webservice.com:3001
Notice in the 2nd example, I’ve provided a port number. This is common with web services where it uses a specific designated port.