Library / Blogs
Nordic APIs Engineering Blog
Learn how to make smarter tech decisions using APIs. The number one resource for API practitioners containing API insights.
By Nordic APIs engineers · Nordic APIs · Added 2026-10-12
All content belongs to Nordic APIs engineers / Nordic APIs. We only link to it and give credit. Report a problem
Learn this article
About 37 min left. Your work is saved as you go.
What you are about to study
Nordic APIs wrote this to explain how they thought about a problem. You should know the basics: caching, queues and replication.
Ideas you will meet
- Distributed Systems
- Consensus, time, failure and the fundamentals of scale-out.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Networking and Web Security Deep Dive · 12 minProxies, NAT, VPNs and firewallsThe network middlemen: what forward and reverse proxies do, how NAT shares addresses, what a VPN protects and how firewalls decide what passes.Read here
Why middlemen exist
Between a client and a server there are often several intermediaries. Each solves a different problem: hide, share, protect or control. Knowing which is which keeps architecture diagrams honest.
Forward proxy (acts for clients)
A forward proxy sits in front of clients. Clients send requests to it and it fetches from the internet on their behalf.
- Why: control and log outbound access (company networks), filter content, cache, hide client addresses, bypass regional limits.
- Who knows what: the server sees the proxy, not the client.
- Example: a company proxy that only allows approved sites; an egress proxy that lets servers call only listed external APIs.
Reverse proxy (acts for servers)
A reverse proxy sits in front of servers. Clients think they talk to the site; the proxy forwards to the right backend.
- Why: TLS termination, load balancing, caching and compression, routing by host or path, hiding the internal layout, absorbing attacks and slow clients, adding headers.
- Examples: NGINX, HAProxy, Envoy, cloud load balancers, CDNs (a CDN is a reverse proxy network).
- An API gateway is a reverse proxy with API-specific policy (see the load balancing lesson).
100%Figure SDA-NSD-02-1 · Forward and reverse proxies · © forcsguy.com
Before: forward proxy
100%After: reverse proxy
100%What changed
- A forward proxy acts for the clients, a reverse proxy acts for the servers
- A reverse proxy hides and protects the backend
- Both sit in the middle but face opposite ways
NAT: sharing addresses
IPv4 addresses are scarce. Network Address Translation (NAT) lets many devices with private addresses (
10.x.x.x,172.16-31.x.x,192.168.x.x) share one public address. The NAT device rewrites the source address and port of outgoing packets and remembers the mapping to send replies back to the right device.- Side effect: devices behind NAT are not directly reachable from outside, which is a mild protection but not a firewall.
- In the cloud, a NAT gateway lets private servers reach the internet (for updates and APIs) without being reachable from it.
- NAT complicates peer-to-peer connections (hence STUN, TURN and ICE in video calls; see the real-time communication lesson).
- IPv6 has enough addresses that NAT is not needed for scarcity.
VPN: a private tunnel
A virtual private network creates an encrypted tunnel across an untrusted network.
- Remote access: staff connect to the company network from anywhere.
- Site to site: two networks (office and cloud) are joined securely.
- Privacy services: traffic is routed via a provider's server.
- It protects traffic in transit between the endpoints; it does not make the endpoints themselves safe. Modern designs increasingly favour zero trust: authenticate every request to every service, rather than trusting "inside the network".
Firewalls: allow or deny
A firewall filters traffic by rules.
- Packet filter / stateless: allow or deny by source and destination IP, port and protocol.
- Stateful: remembers connections, so replies to allowed outbound traffic are allowed automatically.
- Application-layer / WAF: understands HTTP and blocks known attack patterns (for example SQL injection attempts).
- In the cloud: security groups (attached to instances, stateful) and network ACLs (on subnets, often stateless).
100%Figure SDA-NSD-02-2 · Layered network defence for a web app · © forcsguy.com
Principles: default deny, least privilege (open only needed ports to only needed sources), segment (separate tiers and environments), and log. A rule that says "allow all from anywhere" on a database port is a classic breach.
Putting it together
Device Sits in front of Main purpose Forward proxy Clients Control and anonymise outbound traffic Reverse proxy / load balancer Servers Route, protect, terminate TLS NAT A private network Share addresses, hide internals VPN Two endpoints or networks Encrypted tunnel over untrusted links Firewall A network or host Allow or deny traffic by rules Common mistakes
Treating NAT or a VPN as sufficient security; databases reachable from the internet; no outbound restrictions (a compromised server can call anywhere); admin tools exposed publicly; and forgetting that a TLS-terminating proxy sees plain text and must itself be protected.
Real-world reading
Related reading
- NGINX HTTP Load BalancingNGINX · F5 / NGINXDocumentation
- Google SRE Book: Load Balancing in the DatacenterGoogle SRE team · GoogleBlogs
- Load Balancing infrastructure to support more than 1.3 billion users at FacebookFacebook engineers · FacebookCase Studies
- Scaling Load Balancing Infra to Support 1.3 Billion Users at Facebook - Patrick Shuff, Production Engineer at FacebookFacebookYouTube
Show 6 moreShow fewer
- Traffic Infrastructure (Edge Network) at DropboxDropbox engineers · DropboxCase Studies
- Intelligent DNS based load balancing at DropboxDropbox engineers · DropboxCase Studies
- Envoy ProxyEnvoy · CNCF / EnvoyGitHub
- Top Five (Load Balancing) Scalability PatternsF5 engineers · F5Case Studies
- Gaurav Sen: System Design PlaylistGaurav Sen · Gaurav Sen (YouTube)YouTube
- Nordic APIs Engineering BlogNordic APIs engineers · Nordic APIsBlogs
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as Nordic APIs Engineering Blog.
Warm upGet the vocabulary first.
Books · Free from the author
Concurrent and Distributed Systems (Cambridge lecture notes)
Eight lectures on time, broadcast, replication, consensus and transactions, with notes, slides and video. Free from the author under CC BY-SA.
University of CambridgeIntermediate
Books · Free from the author
Computer Networks: A Systems Approach
How networks are built and why: protocols, routing, congestion control and the internet's architecture. The authors publish it free online under CC BY 4.0.
Systems ApproachIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs · Free from the author · Read here
Scalable Web Architecture and Distributed Systems
A full chapter on the building blocks of large websites: availability, performance, reliability, scalability, caches, proxies, indexes, load balancers and queues. Free to read here under CC BY 3.0.
The Architecture of Open Source ApplicationsBeginner40 min
Papers · Read here
Facebook’s photo storage
This paper describes Haystack, an object storage system optimized for Facebook’s Photos application. Facebook currently stores over 260 billion images, which translates to over 20 petabytes of data.
USENIXIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Aroma: Using ML for Code Recommendation at Facebook
Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…
FacebookIntermediate
Case Studies · Read here
Brooklin: Distributed Service for Near Real-Time Data Streaming at LinkedIn
Brooklin—a distributed service for streaming data in near real-time and at scale—has been running in production at LinkedIn since 2016, powering thousands of data streams and over 2 trillion messages per day. Today, w...
LinkedInIntermediate
Read the codeSee how it looks when it is real.
GitHub
Engineering Blogs
A huge directory of company engineering blogs to learn from real production systems.
kilimchoiIntermediate
GitHub
Awesome Scalability
Curated reading list of articles on the architecture of scalable, reliable systems.
binhnguyennusIntermediate
Keep learning
Loading community…