Menu
Coddy logo textTech

The User Agent

Lesson 44 of 47 in Coddy's Networking with the Terminal course.

Every request announces what made it, in the User-Agent header. curl sends its own name and version; a browser sends a long historical string.

This matters more than it looks. Servers routinely behave differently based on it: serving a mobile layout, blocking unknown clients, or rejecting anything that looks automated. So "it works in my browser but not in curl" is often exactly this header, and nothing deeper.

curl -s -A 'my-monitor/1.0' http://127.0.0.1:9133/

-A sets it, and it is simply a shorthand for -H 'User-Agent: ...'.

If you run automated requests against a service, setting an honest User-Agent that names your tool is good manners: when your traffic causes a problem, whoever is on call can tell what it is and who to ask.

challenge icon

Challenge

Hard

Introduce yourself honestly.

  1. Start the capture listener on port 9133
  2. Make a request identifying itself as my-monitor/1.0
  3. Print the user agent line from req.txt

Expected output:

User-Agent: my-monitor/1.0

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Networking with the Terminal

Practice on your own: Terminal playground