DEV Community

Cover image for Simplify the forward and reverse proxy with it's uses
MD. Obaidullah Al-Faruk
MD. Obaidullah Al-Faruk

Posted on

Simplify the forward and reverse proxy with it's uses

Proxy

In simple terms, proxy is doing something on behalf. According to Wikipedia,

In computer networking, a proxy server is a server application that acts as an intermediary between a client requesting a resource and the server providing that resource. It improves privacy, security, and performance in the process.
wikipedia

Types of proxy: There are multiple types of proxy.

  • Forward proxy
  • Reverse proxy
  • Residential proxy
  • Anonymous proxy
  • Transparent proxy
  • Rotating proxy and so on.

In this article, let’s understand two most used proxies which are forward proxy and reverse proxy clearly.

Forward proxy

By definition, A forward proxy server allows computers or devices (Clients) isolated on a private network to communicate with the public network.
Let’s make it more simple, A forward proxy seats between you and multiple public servers. It receives your request and passes it to the public server on behalf of you. Let’s make it more clear with an example. Imagine the management of your office doesn't want their employees to use facebook. So they create a forward proxy, which will monitor traffic and block all requests for the facebook domain or filter contents which are not appropriate. (Consider you don’t know about VPN)

Reverse proxy

On the other hand, A reverse proxy lets you access a private network. Let’s make it more simple, A reverse proxy sits between you and the web application running on a private network. You make the request to the publicly exposed domain or IP and that receives your request and passes to the application server.
Let’s make it more clear with an example. Consider, you have a node js application running on a machine on port 5000. You should not expose this port directly to the public network because of security reasons, SSL/TLS termination, load balancing, caching and so others which can be handled by a dedicated web server (nginx, Apache). So what you can do is that you can set up a web server in front of the node application and expose the http port, which is port 80 and configure that in the web server. Now the client will request this web server and the web server will handle it and forward it to the node application. This is how using reverse proxy, you can make your node application more secure.

Combining Together

Can we imagine forward and reverse proxy in one example ? YES. We can. In your office, You want to visit a site https://www.wikipedia.org. So you went to the browser and typed this domain. Your request goes to forward proxy first. It checks your request and finds no issue. Then it will forward it and it reaches the web server. But this web server is not running the application. The web application is running on a different port or a different private IP. So the web server will forward it (reverse proxy) to the application server. The application server will process your request and give you the response back through the web server. Now it makes more sense, right ?

In short, a forward proxy seats in front of clients whereas a reverse proxy takes place in front of servers.

Top comments (1)

Collapse
 
toufiquehasan07 profile image
Toufique Hasan

Well written! Got a clear understanding of forward and reverse proxy.