What are the disadvantages of reverse proxy?
Well it is all relative.
They are generally considered a way to separate web servers from each other and any other services on the server.
In the case of a web server this can be a disadvantage if the reverse proxy is on a different subnet. With a load balancer and SSL termination on the same subnet, it won't have this problem.
The other issue is that in some cases the reverse proxy has more overhead than a standard web server. It has to have the ability to load balance connections and forward them to the backend web servers.
Now, some of this could be mitigated by using a reverse proxy which provides load balancing and SSL termination.
Why would you deploy a reverse proxy?
Reverse proxies have a long history as a secure and privacy enhancing feature of web applications.
However, recent attacks have shown reverse proxy servers are often vulnerable and sometimes their configuration allows for malicious users to bypass the security of the proxy.
The goal of a reverse proxy server is to allow access to a protected resource (such as a website) from a less secure, public network while acting as a security proxy and filtering traffic to and from that resource. A common misunderstanding of the reverse proxy is that it will only filter HTTP traffic (for example, blocking the X-Forwarded-For header). This can be used for many things such as filtering spam or malware, but also more maliciously such as blocking user sessions. While other kinds of proxy protocols can be used to forward non-HTTP traffic (like SCTP), they generally require additional code and setup, making them unsuitable for most applications.
The basic idea of the reverse proxy is simple. Instead of allowing direct access to a website, the proxy allows access through the proxy instead. If you've heard the words "application firewall", this is exactly what a reverse proxy does: it acts as a security proxy to a website, and allows access to all of the web pages in that website from behind the proxy.
The proxy then sends requests to the protected resource and returns responses to the requester, without revealing any details of what was accessed on the protected resource. This prevents the resource owner or the service provider (such as an ISP or wireless provider) from seeing what data was accessed by the user. This method is frequently used to block access to sensitive information such as credit card details or personal information.
With proper configuration, a reverse proxy can also provide many features that make websites more secure. It can help ensure site pages can only be accessed by authenticated users, it can encrypt traffic to and from the protected resource, it can modify http responses in a variety of ways, and it can help prevent denial of service attacks against the protected resource.
In general, a reverse proxy can: Prohibit unauthenticated users from accessing a protected resource (like a website, for example). Encrypt all communication from protected resources behind the proxy. Protect against a wide range of denial of service attacks.
Why would you use a reverse proxy?
I have been wondering for a while now why would someone use a reverse proxy, and what are the benefits?
I think your question is more general than just about reverse proxies. But to answer specifically your question, one reason would be for load balancing. If you have multiple servers, you can configure the reverse proxy to route requests to a single server and then multiplex across them (if the back-end server supports that).
Another use would be for session persistence. You can use a reverse proxy to keep sessions alive across multiple servers.
I would say the main reason is for load-balancing. The simplest way to think of it is to use a reverse proxy to offload some of the work of serving static files from the web server. This allows you to focus on the dynamic (or at least not spend time on serving static files) aspects of your web server.
Another thing to consider is the "stateless" nature of the HTTP protocol. When I say "stateless", I mean the idea that every request is independent of other requests. In other words, there is no concept of "session". When you're working with a reverse proxy, it's common to "stick" the user to a single IP address. This allows the reverse proxy to be in the position of caching the user's content and serving it to them rather than having to create a new connection to the web server for every request.
Why use a reverse proxy instead of a load balancer?
There is one common situation when you have a set of machines, which are doing some work.
The load balancing is done by a standard load balancer, so it is a matter of using the standard load balancer configuration.
However, some of the services provided by the server are not available on all the machines. For example, some servers are web servers and some are database servers. A load balancer doesn't provide any service (it just forwards the request). Thus, there needs to be a reverse proxy which will do some work and forward the requests to the right backend.
A reverse proxy like Varnish or Nginx is one of those software that sits between the client and the backend server. They perform two roles; They receive the request from the client, and decide which backend server to connect to. They connect to the backend server and pass the response to the client. If your backend servers are all doing the same job (eg serving static content), then you don't need a reverse proxy. You can achieve the same with a load balancer (eg HAProxy) but I'd recommend a reverse proxy for the following reasons: In addition to load balancing, they also cache the results, making them a lot faster than a load balancer. In addition to being faster, reverse proxies also have the following benefits over load balancers: You don't need to setup and maintain any other software. You don't have to worry about the load balancer failing and losing connection to the backend. You can make use of the cache if you need to. I think this answer is still relevant. A reverse proxy can do more than a load balancer in that it allows for caching.
For example, if you have a load balancer that sits in front of a server, it will always send a request to the server. That server does something, sends back a response, and the load balancer will forward that response to the client. If you had a cache, the load balancer would send the request to the cache, receive a response, and store that response locally. Later, when the same request comes in, the load balancer will send the request to the cache first and receive a response from the cache.
Related Answers
What Is the Purpose of a Reverse Proxy?
In the case of a web server, a load balancer is a computer or network devi...
The key features of a reverse proxy
There's a lot of confusion and mis-infor...
Whats the best VPN for privacy Reddit recommends?
I will not spend time or money on a VPN. I simply do not need a VPN....