What is Forward Proxy and Reverse Proxy
Tags: cybersecurity, security, hacktoberfest, hacking
Published: 2023-12-02 17:25:16

We will encounter the terms forward proxy and reverse proxy at every turn. Before we get into the topic, let's answer a key question - what is a proxy? Simply put, it is a server or software that mediates the flow of Internet traffic, that is, for example, making HTTP requests for us. There are two types of proxies - forward proxy and reverse proxy.

## Forward proxy

When encountering the term "proxy" in documentation or articles, authors will most likely have in mind the term forward proxy. It provides single or multiple clients with access to a proxy service on a common internal network. This service acts as an intermediary that performs tasks on behalf of clients over the Internet. This means that each request before it reaches the server first passes through the proxy server, which then executes it. This is illustrated in the figure below.

```
+---------------------------------------------------------------+
|                                                               |
|   Client 1  -+                                +--> Server 1   |
|   Client 2  -+--> Forward Proxy --> Internet -+--> Server 2   |
|   Client 3  -+                                +--> Server 3   |
|                                                               |
+---------------------------------------------------------------+
```

Interestingly, not all requests sent to the forward proxy server may be allowed. Whether the server rejects them depends on its configuration.

If a proxy server gets a response, it returns the response to the client. From a security standpoint, proxy servers are mainly intended to anonymize the user for the end server. However, there is another important use for proxy servers - it is to use them for web proxy caching. This involves storing copies of frequently used web data (documents, images and articles) for faster delivery to multiple users.

## Reverse proxy

Reverse proxy, as the name suggests, is the reverse of forward proxy. Forward proxy works on behalf of users, where reverse proxy works on behalf of backend servers. Reverse proxies were originally used for load balancing in an application (i.e. load balancer) and to achieve high availability (High availability). How does wikipedia define it?

> High reliability system (SWN), high availability system - information systems characterized by appropriately adapted: reliability, availability, performance to specific, usually critical, applications of a given system.
>
> Wikiepdia

Reverse proxy receives rulings from clients and then forwards queries to backend servers. When it receives a response, it serves it to the clients. The whole thing is illustrated in the figure below.

```

+---------------------------------------------------------------+
|                                                               |
|   Client 1  -+                                +--> Server 1   |
|   Client 2  -+--> Internet --> Reverse Proxy -+--> Server 2   |
|   Client 3  -+                                +--> Server 3   |
|                                                               |
+---------------------------------------------------------------+
```

Among the most recognized reverse proxy servers for HTTP communications is [nginx](https://nginx.org/).

## Summary

To summarize the whole article, the main difference we can see between both proxies is that forward proxy anonymizes the identity of clients, while reverse proxy hides the identity of the end (backend) servers with which it communicates on behalf of users.

## Sources

<https://nginx.org/>
<https://stackoverflow.com/questions/224664/whats-the-difference-between-a-proxy-server-and-a-reverse-proxy-server>
[ttps://dltlabs.medium.com/demystifying-forward-and-reverse-proxies-e52eea330e85](https://dltlabs.medium.com/demystifying-forward-and-reverse-proxies-e52eea330e85)
<https://www.websense.com/content/support/library/web/v773/wcg_help/proxy2.aspx>