A curl in every port

A few years back, Zach Bloom wrote The History of the URL: Path, Fragment, Query, and Auth. He recently expanded on it and republished it on the Cloudflare blog as The History of the URL. It’s well worth the time to read the whole thing. It’s packed full of fascinating tidbits.

In the section on ports, Zach says:

The timeline of Gopher and HTTP can be evidenced by their default port numbers. Gopher is 70, HTTP 80. The HTTP port was assigned (likely by Jon Postel at the IANA) at the request of Tim Berners-Lee sometime between 1990 and 1992.

Ooh, I can give you an exact date! It was January 24th, 1992. I know this because of the hack week in CERN last year to recreate the first ever web browser.

Kimberly was spelunking down the original source code, when she came across this line in the HTUtils.h file:

#define TCP_PORT 80 /* Allocated to http by Jon Postel/ISI 24-Jan-92 */

We showed this to Jean-François Groff, who worked on the original web technologies like libwww, the forerunner to libcurl. He remembers that day. It felt like they had “made it”, receiving the official blessing of Jon Postel (in the same RFC, incidentally, that gave port 70 to Gopher).

Then he told us something interesting about the next line of code:

#define OLD_TCP_PORT 2784 /* Try the old one if no answer on 80 */

Port 2784? That seems like an odd choice. Most of us would choose something easy to remember.

Well, it turns out that 2784 is easy to remember if you’re Tim Berners-Lee.

Those were the last four digits of his parents’ phone number.

Have you published a response to this? :

Responses

blog.jim-nielsen.com

As I go through my daily work in web dev, I constantly have questions bouncing around in my head that are too low of a priority to really research. But, when they bounce around in my head long enough, my curiosity won’t let me sit idly by.

One such bouncing question deals with port numbers. It seems like every time I run npm start on a web project, it’s a roll of the dice as to which port of localhost I’ll get a local dev server on.

I understand perfect uniformity across all projects is unlikely (not everyone will be on port 8000), but it’s also not completely random across the entire spectrum of thousands of ports (I never get a local dev server on 4971 or 9571 or 6373).

Why does the local dev server port always seem to be a random selection between about four to five ports?

I asked on Twitter:

Does somebody have an article like “A short history of port numbers” that describes why I never get a consistent default port experience across tools? Some commons ones I consistently see:

localhostlocalhost:3000localhost:8000localhost:8080localhost:8888

And further:

why/where did those numbers pop into our collective culture? why not 2000 or 4000? or why not 6666? or any other random number for that matter?

To be clear, this post is not meant to be the definitive answer to that question. But I read enough random links on the internet to arrive at what feels like a satisfactory answer (though I can’t vouch for the accuracy of it).

So I will try re-stating what I found across various resources on the web and see if I can weave them all into a coherent narrative.

Ports 80

Ports 0-1023 are considered “system ports” (a.k.a “well-known ports” or “privileged ports”). They are reserved by the system for specific applications.

For example, the following ports are reserved by the system for well-known services:

  • 21 FTP
  • 25 SMTP
  • 80 HTTP
  • 443 HTTPS

But why 80 and 443 for HTTP and HTTPS? Why not 51 and 666?

It appears that IANA (a department of ICANN) published RFC1060 in 1990 listing all well-known ports at that point in time and port 80 was unclaimed. When Tim Burners-Lee issued the first version of HTTP in 1991, he used port 80 for HTTP. Later, in 1992, RFC1060 was reissued and port 80 was claimed by HTTP. As for 443, its history is less clear but it officially showed up as claimed by HTTPS in an RFC in 1994.

(Update: turns out, 2784 was the port number for the web before 80 was — thank you Jeremy!)

Ok so, an HTTP server runs on port 80. But what if you’re doing local development? The standard HTTP port 80 is privileged and requires root access (which would be a hassle to provide every time you start the server). Plus, you don’t want your development server interfering with other running processes on your machine. So what you need is an alternative port number for your local dev server that is above 1024.

(Update: turns out macOS no longer enforces privileged ports (Hacker News thread) — thank you Carl Johnson.)

What number do you choose? Well, I’m going to guess that people just wanted a number that was easy to remember so they went with variants of the reserved HTTP port (80) which is how we got conventions for local HTTP servers to run on ports like 8000, 8080, 8888 and 8008[1].

It appears that lots of services (and malware) were built on top of these well-known HTTP alternative ports. For example:

  • Port 8000: was used by VmWare, VMotion, AWS Local DynamoDB, Canon Management Console, Django Dev Server, and Winamp Audio Streaming — but also by malware and spybots.
  • Port 8080 was used by Unreal Tournament and Microsoft Lync — but also by trojans and backdoor worm exploits.
  • Port 8888 was used by MAMP — but also, you get it, more malware.

Ports 30

So what about port 3000? That doesn’t even have an eight in it anywhere. Where did that number come from?

I’m personally aware of the prevelance of port 3000 because of its ubiquity in the Node ecosystem. But from what I gather, Ruby (which predates Node) also uses 3000 prevalently (and, as you probably guessed, malware uses it too). Ultimately, I cannot find a story behind that port.[2]

That said, once a project like Node does something you can imagine how it spreads: for whatever reason, somebody starts using port 3000 in code or docs or examples, and that spreads to become the standard port for starting an HTTP server in Node. From there the number spread like wildfire into the community and tooling (which would explain why the first place I remember seeing port 3000 used in a dev server was when I first used create-react-app).

Conclusion

Phew. I think I have sufficiently answered my own question to a degree of satisfaction where my curiosity will let me rest.

Some additional links from my research:

  1. IANA is responsible for resources related to internet protocols and it appears you can register (i.e. reserve) commonly used port numbers for well-known services. For example, 8008, 8080, and 591 are all considered HTTP alternatives, a.k.a. http-alt. 591 seems like a random outlier, but it appears to be because FileMaker chose to use it as an alternative port (and registered it as one).
  2. Port 3000 is registered with IANA for “RemoteWare Client” and “HBCI”. If you Google those names with the people who registered them, the furthest convo back I can find is an obscure mailing list text that sheds no light on the subject. So who knows where 3000 came from.

# Monday, January 23rd, 2023 at 7:00pm

10 Shares

# Shared by Michael Wells on Wednesday, March 11th, 2020 at 4:27pm

# Shared by Daniel J. Hansen 🌊🌊🌊🌊 on Wednesday, March 11th, 2020 at 4:28pm

# Shared by Lee Griffin on Wednesday, March 11th, 2020 at 4:28pm

# Shared by ☯Evil Jim O'Donnell on Wednesday, March 11th, 2020 at 4:32pm

# Shared by ʦ on Wednesday, March 11th, 2020 at 4:39pm

# Shared by ch12i5 on Wednesday, March 11th, 2020 at 10:10pm

# Shared by Steve Lee on Thursday, March 12th, 2020 at 11:56am

# Shared by Jim Nielsen on Tuesday, January 24th, 2023 at 2:43pm

# Shared by Kristof Zerbe on Tuesday, January 24th, 2023 at 4:45pm

# Shared by Arunan on Wednesday, January 25th, 2023 at 1:25pm

27 Likes

# Liked by Jamie Tanna on Wednesday, March 11th, 2020 at 5:56pm

# Liked by Oliver Ash on Wednesday, March 11th, 2020 at 11:12pm

# Liked by ch12i5 on Wednesday, March 11th, 2020 at 11:12pm

# Liked by 🤎 John Crean 💛 on Wednesday, March 11th, 2020 at 11:13pm

# Liked by Chris Taylor on Wednesday, March 11th, 2020 at 11:13pm

# Liked by Harry Roberts on Wednesday, March 11th, 2020 at 11:14pm

# Liked by ʦ on Wednesday, March 11th, 2020 at 11:15pm

# Liked by Skúli Arnlaugsson on Wednesday, March 11th, 2020 at 11:15pm

# Liked by Haroen Viaene on Wednesday, March 11th, 2020 at 11:16pm

# Liked by Mike Goodwin /// on Wednesday, March 11th, 2020 at 11:16pm

# Liked by Ξ M I L I Λ N O on Wednesday, March 11th, 2020 at 11:16pm

# Liked by Flor Coppola on Wednesday, March 11th, 2020 at 11:17pm

# Liked by Laurence Hughes on Wednesday, March 11th, 2020 at 11:17pm

# Liked by Søren Birkemeyer 🦊 on Wednesday, March 11th, 2020 at 11:17pm

# Liked by Arne Hassel on Wednesday, March 11th, 2020 at 11:17pm

# Liked by Daniel J. Hansen 🌊 🌊 🌊 🌊 on Wednesday, March 11th, 2020 at 11:19pm

# Liked by Lee Griffin on Wednesday, March 11th, 2020 at 11:19pm

# Liked by Tyler Christensen on Wednesday, March 11th, 2020 at 11:20pm

# Liked by MatthewTyleeAtkinson on Wednesday, March 11th, 2020 at 11:20pm

# Liked by ☯ Evil Jim O'Donnell on Wednesday, March 11th, 2020 at 11:21pm

# Liked by Adam Beres-Deak on Wednesday, March 11th, 2020 at 11:21pm

# Liked by Morgan Hallgren on Thursday, March 12th, 2020 at 7:30am

# Liked by Steve Lee on Thursday, March 12th, 2020 at 12:20pm

# Liked by Fabio Venni on Thursday, March 12th, 2020 at 1:07pm

# Liked by Lennie Appelquist on Friday, March 13th, 2020 at 4:22am

# Liked by Tyler Gaw on Tuesday, January 24th, 2023 at 2:43pm

# Liked by Jim Nielsen on Tuesday, January 24th, 2023 at 2:43pm

1 Bookmark

# Bookmarked by Webrocker on Wednesday, March 11th, 2020 at 5:54pm

Related posts

Web talk

How we built How We Built The World Wide Web In Five Days in more than five days.

Related links

Networked information services: The world-wide web [PDF]

A 1992 paper by Tim Berners-Lee, Robert Cailliau, and Jean-Françoise Groff.

The W3 project is not a research project, but a practical plan to implement a global information system.

Tagged with

WWW:BTB — History (Overview)

This history of the World Wide Web from 1996 is interesting for the way it culminates with …Java. At that time, the language seemed like it would become the programmatic lingua franca for the web. Brendan Eich sure upset that apple cart.

Tagged with

FOREVERYONE.NET

I linked to this a while back but now this great half hour documentary by Jessica Yu is ready and you can watch the whole thing online: Tim Berners-Lee, the birth of the web, and where the web has gone since.

In the scenes describing the early web, there’s footage of the recreated Line Mode Browser—how cool is that‽

Tagged with

Recreating the first web browser at CERN | Flickr

Photos from earlier this week:

In a small room in CERN’s Data Center, an international group of nine developers is taking a plunge back in time to the beginnings of the World Wide Web. Their aim is to enable the whole world to experience what the web looked like viewed within the very first browser developed by Tim Berners-Lee.

Tagged with

The world-wide web (PDF) by T.J. Berners-Lee, R. Cailliau and J.-F. Groff

Well, look at these fresh-faced lads presenting their little hypertext system in 1992. A fascinating time capsule.

Tagged with

Previously on this day

5 years ago I wrote T minus one

‘Twas the night before Web@30, and not a particle was stirring, not even a meson.

8 years ago I wrote Accessible progressive disclosure

Using ARIA attributes to power JavaScript functionality.

10 years ago I wrote Return of the Responsive Day Out

It’s baaa-ack!

11 years ago I wrote Off-canvas horizontal lists

Sharing a pattern that didn’t quite work.

13 years ago I wrote Drupalcon in Chi-town

Back in Chicago.

15 years ago I wrote Texapalooza

South by Southwest bound.

19 years ago I wrote Austin update

I’ve arrived in Austin. The South by SouthWest festival hasn’t started yet and I’m already having a great time meeting some wonderful people.

21 years ago I wrote My glamourous life

The last couple of weeks have been pretty busy for me.

22 years ago I wrote Cat Hospital starring Frank the Cat

You can keep an eye on the progress of poor Frank the cat who has become something of a celebrity: