Nginx and reverse proxy
In short: A reverse proxy accepts requests from the internet and forwards them to one or more application servers. Nginx and Caddy are widely used programs for this.
In more detail: The proxy handles tasks in front of the application: TLS encryption, compression, caching, load distribution and protection against overload. The application behind it need not know any of that.
In Depth
- TLS termination: The proxy decrypts HTTPS; internally plain HTTP often runs.
- Static files: Nginx serves images, CSS and JS directly and very fast.
- Headers: The proxy sets headers such as
X-Forwarded-Forso the application knows the real client IP. - Redirects and rewriting: Send old addresses to new ones.
- Counterpart: A forward proxy sits on the client side and forwards its requests to the internet.
See also: Load balancer, CDN (content delivery network)