We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design Masterclass · Load Balancing Proxies
Free preview: the first 2 parts of this 10-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Load Balancing Proxies
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
The last lesson, on path-based routing, kept many services behind one name and split them by path. Picture five services behind example.com, split by path in that way. This lesson gives each one its own name.
The routing rule is almost identical. The reads a field and picks a backend. Everything else changes.

Only the first row is routing. The other four are the reason this decision is much harder to reverse than a routing rule.
That is the honest framing for the whole lesson. Host routing is not a tidier way to arrange the same thing. It draws a boundary the browser will enforce for you, and it takes on a record and a certificate for every name you draw.
Start with the mechanical part. Here is a small server with three names configured, a wildcard, and a default for anything else.

The three spellings in the middle block all reach the product, and all three are legal .
Those spellings are worth being explicit about, because a matcher that misses one of them treats several requests for one site as several different sites.

Four of these are legal and have to be normalised. The last is an attack, and the only correct response is to refuse the request.
The duplicate Host header is worth a sentence of its own. If two components in your chain pick different Host headers from the same request, one of them routes and the other one authorises, and they are working on different requests. Modern servers reject duplicates. Check that yours does instead of assuming it.
Now the wildcard, which is where most of the surprises live.

This is the rule for certificates and the rule for virtual hosts, and it catches people in both places.
The common version of this is a certificate bought for *.example.com that turns out not to cover example.com, discovered the first time somebody types the address without the www. Ask for both names. The same applies to your routing table: *.example.com and example.com are two entries.
The deeper case is worth knowing before you design a naming scheme. If you plan on service.team.example.com, one wildcard will not cover it. You need a wildcard per team, or a name per service.