20 Controlling HTTP traffic to containers with a reverse proxy
Docker takes care of routing external traffic into your containers, but you can have only one container listening on a network port. It’s fine to use any old ports in your nonproduction environments—in some chapters of this book, we’ve used 10 different ports to keep applications separate—but you can’t do that when you go live. You’ll want lots of applications running on a single cluster, but you need them all to be accessible on the standard HTTP and HTTPS ports, 80 and 443.
That’s where a reverse proxy comes in, which is a critical piece in the architecture of a containerized environment. In this chapter, you’ll learn all about the features it provides and the patterns it enables. We’ll use two of the most popular technologies in this space—nginx (pronounced “engine x”) and Traefik (approximately pronounced “traffic”)—running in containers, of course.