Proxies — An in-depth intro

Emmanuel Bakare
Consonance Club
Published in
7 min readMay 20, 2018

This is a story about networking in a far, far land called a VPN with a dictator called Security. It had decided to raise a firewall and ruled over the land denying access to traffic from all users.

Then there came a proxy, a way to reach this network, finally providing access only to those who could get it at last.

I hope y’all weren’t expecting something like “The firewall was brought down”. Security is a dictator but forget it, he’s the good guy 😅.

An example of a proxy setup in networking

So what are proxies?

In computer networks, a proxy server or proxy is a server (a computer system or an application) that acts as an intermediary for requests from clients seeking resources from other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource available from a different server and the proxy server evaluates the request as a way to simplify and control its complexity. Proxies were invented to add structure and encapsulation to distributed systems. Today, most proxies are web proxies, facilitating access to content on the World Wide Web, providing anonymity and may be used to bypass IP address blocking.

Source: https://en.wikipedia.org/wiki/Proxy_server

  1. In general, from the digram above, we see a basic setup of a simple proxy setup. A proxy aims to redirect all traffic from a certain URL to the destination URL by acting as a middleman under a service which is needed to be able to capture all incoming requests.

Firewalls cannot be seen as proxy servers because even though they have the capacity to block or allow requests based on certain rules, they do not route requests.

To learn more about port forwarding for more info, click here.

All proxy servers basically just get the requests and push them to their desired destination , some modification or logging of the requests can be made just like firewalls which do similar things. Proxy servers can also block requests but based on the protocol[HTTP, FTP etc] or the URL of the request.

Proxies also provide authentication services and by default provide anonymity.

TYPES OF PROXIES

Proxies can generally be classified based on two categories:

  1. Routing pattern
  2. Protocol access

The categories are further sub-classified:

Routing Pattern

Tunneling proxies

These proxies intermediately pass the request untouched to the destination. This is the most basic version of a proxy and aids the understanding of what proxies generally do.

Tunnel Proxying

Forward proxies

These proxies get the request, then forward them to a node which passes the request to the final destination. Forward proxies find applications in anonymity proxy servers like VPNs where the requests are directly handled by the first proxied destination to get the request from the sender. They are most times used in intranet settings.

Reverse proxies

A reverse proxy (or surrogate) is a proxy server that appears to clients to be an ordinary server. Reverse proxies forward requests to one or more ordinary servers or proxies which handle the request. The response from the proxy server is returned as if it came directly from the original server, leaving the client with no knowledge of the origin servers. Reverse proxies are installed in the neighborhood of one or more web servers. All traffic coming from the Internet with a destination of one of the neighborhood’s web servers goes through the proxy server. The use of “reverse” originates in its counterpart “forward proxy” since the reverse proxy sits closer to the web server and serves only a restricted set of websites. An example of its application is found in proxy sites and applications such as Psiphon, openVPN, hideMyAss etc.

They’re also useful in load balancers due to their ability to distribute load to multiple server nodes.

Diagram displaying the forward and reverse proxy setup

Protocol Access

These type of proxies are basically just different proxy servers working on different ports which translates to a service they offer.

They namely cover the following :

SOCKS Proxy

  • These work for socket connections made to the proxy server which can be found on port 1080 from the request server

HTTP Proxy

  • These work for internet based connections which can be found on the port 80 from the request server.

FTP Proxy

  • This is for FTP connections which generally run on port 21 and 22 for Secure FTP[SFTP] connections.

SSL [HTTPS] Proxy

  • This is for secure SSL [Secure Socket Layer] connections which add an extra layer of encryption through the use of certificates for more secure connections. These connections use the 443 [HTTPS] port from the request server.

So how do we access a proxy on a network?

From our definition 1, what should be noted is the part in bold which is the URL. Proxies are servers and like all servers, they host a service which would use a port and an IP address which we can then use to access them.

For example, for those who’ve never used a proxy list as shown below:

A proxy list example showcasing multiple proxy server IP addresses and ports

You’d notice the proxy servers have both an IP address and a port. That’s what we’d need to be able to use a proxy. Before we continue, let’s get a better understanding of what the syntax for full URL’s are.

Defining the perfect proxy URI

The general syntax for a URL can be expressed as

URI = scheme:[//authority]path[?query][#fragment]whereauthority = [username:password@]host[:port]
scheme is the protocol in use [file, ftp, http, https, socks] etc.

Source: https://en.wikipedia.org/wiki/URL#Syntax

We can ignore the other fields not described.

The host is either an IP address or a normal website [FQDN — Fully Qualified Domain Name] address. The port is a number which ranges from 0 to 65535.

The reason for the username:password field in the URI which might seem new is to act as a valid means of authenticating directly when accessing a resource/site that requires username and/or password authentication.

The absence of those parameters in the proxy URI would result in no authentication and cause the proxy server to return a 407Proxy Authentication Required response.

Check out more here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/407

A note on proxies and the OSI Model

For those who aren’t too savvy in networking, we all might have once heard of a thing called the OSI [Open Systems Interconnection] Model (Diagram Below).

OSI Model Stack

I won’t explain in full detail what the OSI model is. A basic definition is that it is just an abstraction of the different components that make up a complete connection.

More details about the OSI Model can be found here: https://www.reddit.com/r/explainlikeimfive/comments/jmg1x/eli5_can_someone_explain_the_osi_model_like_i_am_5/

SIDE NOTE: I actually added “to a 5 year old” in the Google query, LOL!!!

Back to accessing proxies

Now that we understand how the URL’s work and have a basic understanding of the OSI model, we can head down to getting access using the URL which we can now finally understand.

Proxies, if you got the reference about the OSI model, work on the Application layer which is model 7 cause if you remember, they work based on protocols.

Proxies act on protocols which are in the Application Layer

Therefore, what this means is that for us to be able to use the proxy, the application we desire to use (Browser, FTP Client, Operating System Software etc) must provide the features to send a request to a proxy server. If absent, we could then employ the use of a VPN which would then aim to use the proxy address we’ve been able to attain to correctly send the request to the right proxy IP and port based on the protocol. Some applications also have the ability to get the proxies automatically.

Mozilla’s Proxy Configuration Page [Notice there’s an input for each protocol]

SIDE NOTE: VPN’s are able to do this because, just like firewalls, they are able to access all incoming or outgoing requests. Hence it’s possible to have a firewall and proxy service together using a VPN.

Check out Drony on Android or tunnelBear if you’re interested in finding out more.

Conclusion

In this series, we’ve been able to uncover the differences between a firewall and a proxy, understand the OSI layer, URI schema’s and fully derive what the different kinds of proxies are and how they’re used.

Don’t forget to follow, I’d be writing more of these soon 😁.

And also, I swear I’m not boring. You might not regret it 😊.

.

--

--