Proxy Servers used in Real Life

Ted Wu
Code Intersect
Published in
4 min readMar 1, 2017

Today I learned the use cases and importance of proxy servers and I’ve decided to share some of the knowledge I’ve learned.

Let’s start off with a simple definition:

Proxy server is a server between two machines. It could be multiple users or one user on one side and another web server/web servers on the other. A proxy server basically acts as middle man that handles the requests and returns the response back to the users.

A normal networking lifecycle works like this:

Client => Proxy server evaluates the request => Request service or resources from web server => Proxy Server returns the resources back to the client

Let’s go through each step

1. A user requests a webpage by typing in www.google.com

2. The proxy server will then look into the cache and see if the resource is the cache. If it finds it, then it will return it to the user. If the page is not there, the proxy server will make a connection to Google’s server. Then a proxy server will save the resource to the cache.

3. When the internet returns the requested resource, the proxy server will relate it to the original request and forward it to the user.

Proxy servers are useful because of the following:

Privacy

A proxy server protects the privacy of the individual user because within a private network, each machine will have its own private IP address (let’s say it’s 10.7.6.1.8). The user will make a request to the proxy server and when the web server receives a request from the proxy server, it only gets the proxy server’s IP address (e.g., 104.196.39.73). Therefore it provides anonymity for the individual users surfing the Internet.

Imagine you are writing a love letter to your crush. You can ask your friend to be the “proxy server” and deliver the love letter while maintaining your anonymity.

Security

Because there is a proxy server in between the client and the outside server, it provides an extra layer of security. Attackers from the outside would have to find vulnerabilities in the proxy server in order to exploit individual computers. There are other ways to break into the systems but that is a different discussion.

Logging network requests

Proxy servers also have log messages for all the network requests (i.e., HTTP methods) for monitoring and debugging purposes.

For monitoring, logs are useful because you can detect malicious activities based on hostnames, paths, and urls.

For debugging, the logs have requests information and responses to see if proper request headers are sent or whether the responses are valid.

Performance

Proxy servers improve performance by using caches. When a client requests a webpage and the webpage is in the cache, the proxy server will return the webpage stored in the cache. If not, the proxy server will go to the web server and fetch the appropriate resource. With caches, the performance is optimized especially because server response time is slower when the proxy server has to go to other web servers to fetch the resources.

Here are some of the common cache replacement algorithms that are used to determine what to replace when the cache is full.

I’ve used Charles Proxy Server primarily for logging and debugging network requests/responses. Charles is an HTTP proxy/reverse proxy that enables developers to view all of all the HTTP and SSL/HTTPS traffic between their machine and the internet. I’ve been using Charles to inspect requests, responses, HTTP headers, cookies and caching information so that I can debug HTTP connections and sessions with iOS and Android devices.

Charles proxy is used as a man-in-the-middle HTTPs proxy. Instead of having the browser see our web server’s certificate, Charles generates a certificate for the server and signs it with own root “Charles Certificate”. These SSL (Secure Socket Layer) certificates are small data files that bind a cryptographic key to organization details to secure customer data.

A great video introduction to SSL

Because of a new project at work, I started to use Charles proxy servers to debug connections between my computer and certain iOS test devices. I want to understand the benefits of a proxy server and focus on why we use it rather than on what I need to do. There is so much to learn and that is why I’m documenting my learning so that other people can benefit from this article.

If you enjoyed this piece, please click the💚 below or share to your friends so other people can learn as well!

--

--

Ted Wu
Code Intersect

Life-long learner. ENFP. My mission is to invest in relationships and seek harmony within my career, financial, social, physical, and community wellbeings