{"id":"reverse-proxy-web-server","title":"Reverse proxy (web server)","sections":[{"id":"overview","title":"Overview","html":"<p class=\"figure\">\n  <img src=\"/repo/images/n41Azff.png\" loading=\"lazy\" decoding=\"async\" alt=\"Diagram\">\n  <br>\n  <i><a href=\"https://upload.wikimedia.org/wikipedia/commons/6/67/Reverse_proxy_h2g2bob.svg\" target=\"_blank\" rel=\"noopener noreferrer\">Source: Wikipedia</a></i>\n  <br>\n</p>\n<p>A reverse proxy is a web server that centralizes internal services and provides unified interfaces to the public.  Requests from clients are forwarded to a server that can fulfill it before the reverse proxy returns the server's response to the client.</p>\n<p>Additional benefits include:</p>\n<ul>\n<li><strong>Increased security</strong> - Hide information about backend servers, blacklist IPs, limit number of connections per client</li>\n<li><strong>Increased scalability and flexibility</strong> - Clients only see the reverse proxy's IP, allowing you to scale servers or change their configuration</li>\n<li><strong>SSL termination</strong> - Decrypt incoming requests and encrypt server responses so backend servers do not have to perform these potentially expensive operations\n<ul>\n<li>Removes the need to install <a href=\"https://en.wikipedia.org/wiki/X.509\" target=\"_blank\" rel=\"noopener noreferrer\">X.509 certificates</a> on each server</li>\n</ul>\n</li>\n<li><strong>Compression</strong> - Compress server responses</li>\n<li><strong>Caching</strong> - Return the response for cached requests</li>\n<li><strong>Static content</strong> - Serve static content directly\n<ul>\n<li>HTML/CSS/JS</li>\n<li>Photos</li>\n<li>Videos</li>\n<li>Etc</li>\n</ul>\n</li>\n</ul>","headings":[]},{"id":"load-balancer-vs-reverse-proxy","title":"Load balancer vs reverse proxy","html":"<h3 id=\"load-balancer-vs-reverse-proxy\">Load balancer vs reverse proxy</h3>\n<ul>\n<li>Deploying a load balancer is useful when you have multiple servers.  Often, load balancers  route traffic to a set of servers serving the same function.</li>\n<li>Reverse proxies can be useful even with just one web server or application server, opening up the benefits described in the previous section.</li>\n<li>Solutions such as NGINX and HAProxy can support both layer 7 reverse proxying and load balancing.</li>\n</ul>\n<h3 id=\"disadvantages-reverse-proxy\">Disadvantage(s): reverse proxy</h3>\n<ul>\n<li>Introducing a reverse proxy results in increased complexity.</li>\n<li>A single reverse proxy is a single point of failure, configuring multiple reverse proxies (ie a <a href=\"https://en.wikipedia.org/wiki/Failover\" target=\"_blank\" rel=\"noopener noreferrer\">failover</a>) further increases complexity.</li>\n</ul>\n<h3 id=\"sources-and-further-reading-8\">Source(s) and further reading</h3>\n<ul>\n<li><a href=\"https://www.nginx.com/resources/glossary/reverse-proxy-vs-load-balancer/\" target=\"_blank\" rel=\"noopener noreferrer\">Reverse proxy vs load balancer</a></li>\n<li><a href=\"https://www.nginx.com/blog/inside-nginx-how-we-designed-for-performance-scale/\" target=\"_blank\" rel=\"noopener noreferrer\">NGINX architecture</a></li>\n<li><a href=\"http://www.haproxy.org/download/1.2/doc/architecture.txt\" target=\"_blank\" rel=\"noopener noreferrer\">HAProxy architecture guide</a></li>\n<li><a href=\"https://en.wikipedia.org/wiki/Reverse_proxy\" target=\"_blank\" rel=\"noopener noreferrer\">Wikipedia</a></li>\n</ul>","headings":[{"id":"load-balancer-vs-reverse-proxy","title":"Load balancer vs reverse proxy","depth":3},{"id":"disadvantages-reverse-proxy","title":"Disadvantage(s): reverse proxy","depth":3},{"id":"sources-and-further-reading-8","title":"Source(s) and further reading","depth":3}]}],"sourceFiles":[]}