This is the Month to Learn HTTP

CREDIT: Jatuphon Buraphon via Pexels (CC/2.0)

You won’t beat the grocer for convenience, but you can still learn to grow your own tomatoes. By summer’s end you’ll have planted, tended, harvested, and seasoned your way to the best caprese you’ve ever tasted. You might have learned a bit about vegetables along the way.

Will homegrown goodies replace every trip to the store? Probably not. But they may change how you think about food. And oh—that salad!

Sometimes it’s worth lancing through a few layers of abstraction to get to what lies beneath. If you develop software for the web, a visit down to the Hypertext Transfer Protocol (HTTP) is well worth your time.

Three Reasons

First, understanding HTTP can make your app faster. Peek beneath the sizzling visuals of the modern web and it’s text files all the way down. HTML, CSS, and JavaScript? They’re are all just files, delivered over HTTP. Beyond sharing text documents, HTTP also provides the client (typically a web browser) with metadata hints at how they should be used. Headers describing content-negotiation, encoding, and caching policies can each shape the behavior of an HTTP request. Understanding the transfer process and each header’s place in it will help you debug and optimize your frontend delivery—reason enough to learn the protocol.

But HTTP also informs how downstream systems are designed. Understanding the vendor-implemented caching, compression, and security layers built into the protocol can save you writing your own and simplify your applications. Since they also solve some of the many challenges in network application design, studying them will give context to the problems they’re meant to alleviate.

Finally, HTTP’s design is worth studying in its own right. It is self-documenting, accessible to humans and machines, and easily extended: agents implementing early versions of the spec can still receive text transfered using HTTP. In most cases, the modest inefficiency arising from its plain-text format can be easily offset with server-side compression, or by using the (binary) HTTP/2 extension. Text can be compressed. Legibility can’t be replaced.

Reading up

There’s no better to start reading up than MDN. Once you’ve got the basics, skim the RFC. Seriously. IETF specifications can seem daunting on first encounter, but (plaintext document aside) they strive to be as clear and accessible as possible. Want to learn the protocol? Start with the spec.

Once you have the details, start leaving DevTools’ Network tab open as you browse. Note the frequency and form of HTTP requests and pay attention to the headers different websites use. Seeing how other services leverage HTTP will help you audit your own, and may even reveal new features that could be useful for your own projects.

Which isn’t to say you’ll often be dealing with raw HTTP yourself. Just like the tomatoes, there are easier ways to network than doing it yourself. But the details are still there, under the hood, and when you need them you’ll be ready!

Featured