What are proxies and How proxy work

Hello… This is my first post on Devils Workshop. I was thinking for quite some time on what topic to write, just when there came a bolt from the blue… PROXIES…!!!

Many of us must have heard of it or, could be having an overview of it already, so let’s dive deeper into the vast ocean of proxies…

To put in lay man’s words, a proxy is a server or you can better call it as a gateway with which we can access Internet in large organizations or institutions. It is some thing like this:

proxy-server-22

A proxy can be considered as an entity which serves client requests on behalf of a original web server. A proxy usually provides some kind of caching.

Let us walk through an example:

  • Say, you are surfing the Internet in your college and you are accessing the Internet through a Proxy, and you have entered www.devilsworkshop.org in your browser…
  • First, your browser establishes a TCP connection with your Proxy and it requests the webpage – www.devilsworkshop.org.
  • Your Proxy, first checks whether it has a copy of the webpage stored locally. If it has, it services your request by sending the webpage to you.
  • If not, your proxy in turn establishes a connection with the original web server (your ISP) and obtains the webpage, keeps a copy of the webpage locally and also sends you the requested page.

So, what is the big deal in having a proxy?

The advantage comes when, another person say your friend, requests for the same page, the proxy will serve him quicker because, it is having the webpage stored locally. So, a proxy can substantially reduce the Internet traffic it accelerates the client’s web requests. But we know that the contents of the web pages usually changes pretty fast and using a proxy may result in having old pages with outdated content.

How does a proxy deal with this?

Let us continue with the previous example… when a browser requests for the page http://www.devilsworkshop.org/projects/ , the following happens…

The browser sends the request to the Web Proxy. The proxy in turn (assuming that it does not have a cached copy of the page locally) sends a request to the original web server. The request message usually will be of this format:

GET /projects/

Host: www.devilsworkshop.org

The web server sends the requested page to the proxy. It will usually be of this format:

HTTP/1.1 OK

Date:Wed, 22 April 2009 09:45:33 GMT

Server: Apache/2.2.3 (CentOS)

Last Modified: Tues, 21 April 2009 10:53:48 GMT

Content-Type: text/html; charset=UTF-8

( data… data……. data…… )

The proxy forwards the requested page to the client and also stores a copy of the page locally. The most important field in the response message stated above is the Last Modified field. The Proxy, periodically sends a conditional GET to update it’s local copy of the page. It will send a conditional GET request which will be of this format:

GET /projects/

Host: www.devilsworkshop.org

If-modified-since: Tues, 21 April 2009 10:53:48 GMT

The If-Modified-since will be same as the Last modified field in the response message from the web server. The proxy is instructing the server to send the requested page if it had been modified since the specified date. If the object has mot been modified, the web server sends a message to the proxy:

HTTP/1.1 304 Not Modified

Date: Wed, 22 April 2009 13:23:52 GMT

Server: Apache/2.2.3 (CentOS)

So, the proxy, by this method keeps the copies of the page up to date. A proxy, apart from this, also serves to authenticate the users from accessing the network resources, filtering the content and requests, intercepting user requests etc.

I just shared what little knowledge I had on proxies… Please feel free to comment on this article. After all, the ocean of knowledge is endless…

(Image Credits: computer-repair-maintenance)


[Editor’s Note: This article is submitted by Pravin Kenator. This is his first blog post on Devils Workshop.

If you, too would like to write for Devils Workshop, please check this. Details about our revenue sharing programs are here.]

One Comment

Soham March 6, 2010

thnk u..its hlpful…