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 non-production environments—in some chapters of this book, we’ve used ten 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. It’s a critical piece in the architecture of a containerized environment and 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.

20.1 What is a reverse proxy?

20.2 Handling routing and SSL in the reverse proxy

20.3 Improving performance and reliability with the proxy

20.4 Using a cloud-native reverse proxy

20.5 Understanding the patterns a reverse proxy enables

20.6 Lab