The Desi Architect
Notes / Docker Sandboxes / API Gateway: Edge JWT Authentication, Routing & Distributed Rate Limiting
Docker Sandboxes · Tier 1: Building Blocks · Lab 20

API Gateway: Edge JWT Authentication, Routing & Distributed Rate Limiting

Put one gate in front of two services. Check the token, count requests in Redis, route to the right service and hide internal headers. Then see what the gateway cannot do (decide what a user may see), and what happens when a service goes down or hangs.

Time45 minutes
StackJWT (HS256)Ports 18089
MemoryAbout 100 MB
Before thisLab 19JWT and Auth Basics
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Explain what an API gateway does: authentication, rate limiting, routing.
  • Tell authentication from authorization, and show why the gateway cannot do the second.
  • Explain a fixed window rate limit, 429 and Retry-After, and what fail open means.
  • Explain a bulkhead and why a hanging service is worse than a dead one.
  • List what must not leak from behind the gateway.

Before you start

Finish Lab 19 (JWT and Auth Basics) first. You should know what a signed token is. Labs 03 and 06 help too. Docker Desktop must be running.