curl
NetworkPackage: curl
Sends an HTTP (or other) request and shows the response. curl -I reads only the headers, -v shows the whole exchange, TLS included — that is how you tell "the server answers badly" from "the server does not answer".
What its options do in the lessons
From the same glossary the lessons render under their commands, so the two cannot disagree.
curl -I- HEAD request: fetches the headers only.
curl -v- Verbose: shows every step of the connection — including the one that fails — before any HTTP is exchanged.
curl -L- Follows redirects instead of stopping at the 3xx response.
curl -s- Silent: no progress meter and no error messages.
curl -S- With
-s, still shows errors.-sSgives “quiet but not silent”. curl -f- Fails with a non-zero exit code on an HTTP response of 400 or more, instead of saving the error page as though it were the content.
curl -w- Prints a template after the response, where
%{http_code}becomes the HTTP status. With-o /dev/nullthe page is discarded and only the number is left — which is what a check wants to read. curl -H- Adds a header to the request.
-H 'Host: example.com'makes the web server pick that name's virtual host while you are querying a bare IP address: it is how a site gets tested before DNS points at it. curl -o- Writes to a file instead of standard output.
curl -m- Maximum time for the whole transfer, in seconds. Without it, a check script can wait forever.
curl --data-binary- Sends the request body exactly as given, with no re-encoding and no stripping of newlines, unlike
-d. The@fileform reads the body from a file, which is what testing a size limit with real bytes needs. curl --resolve- Pins a hostname to an address you choose, for this request only (
--resolve example.com:443:198.51.100.25). Used to test a new machine’s vhost and certificate while DNS still points at the old one.
Lessons that teach it
- Refused or silent: what each failure provesNetworking: how your server is reached
- Unreachable: find the broken layer before touching anythingNetworking: how your server is reached
- Works on the server, refused from outsideNetworking: how your server is reached
- Serving a React/Vite buildHosting a web application with Nginx
- Which server block answers, and why the wrong site sometimes doesHosting a web application with Nginx
- The limits that refuse: 413 and 504Hosting a web application with Nginx
- The headers you think you setHosting a web application with Nginx
- Creating a site, then putting a Node.js application on itISPConfig: hosting several sites on one server
- Rebuilding the whole machine, in the right orderBackups and restores
- An automated check that is worth havingMonitoring a server
- Publishing the records, and verifying before you continueDNS: pointing a domain at your server
- Why fixing the typo does not help yetDNS: pointing a domain at your server
- Moving a live domain: the record change is the shortest partDNS: pointing a domain at your server
- From a symptom to one component: what the hypothesis forbidsDiagnosing a failure: what each output proves
- Capture before you repair: the state a fix deletesDiagnosing a failure: what each output proves
- Verify before declaring success, and what a rollback does not undoDeploying: releases, the switch and rolling back
- The release that breaks: roll back first, diagnose secondThe capstone: from repository to production
