Web caching is done by a Proxy Server – an intermediate entity between the original server and the client. When a client requests for some information (through an HTTP message), it goes through the proxy server, which –
- First checks if it has the copy locally stored.
- If it has, then it forwards the result directly to the client.
- Otherwise, it queries on behalf of the end host, stores a copy of the result locally, and forwards the result back to the end host.
Web caches (or) Proxy Servers are usually installed by ISPs (Internet service providers), Universities, or even Corporate Offices, wherein multiple end hosts are connected to the proxy server.
Installing a proxy server has multiple advantages –
- It can substantially reduce the response time for repeated requests. (Especially if the bottleneck between the original server and receiver is less than bottleneck between the proxy server and receiver.)
- It reduces the access link bandwidth (of the university or the office), thereby reducing the cost.
- It reduces traffic on the Internet as a whole.
But there is one problem.
What if the content was modified on the original server, rendering the copy on the proxy server to be an outdated one?
This is where Conditional GET statements kicks in. When a Proxy server receives an HTTP request, and it has the result stored locally, it still queries the original server, asking if that particular object was modified since the last time it was requested by the proxy server.
The “Conditional GET” statement has an additional field than a normal GET statement, called the “If-modified-since” field, which specifies the last time when the same request was made. The original server either –
- Tells the proxy server that the content was not modified – HTTP 304 status code, or
- Sends the updated content (in case there was some modification done) – HTTP 200 response-message code
If the Proxy server gets a 304 – “No Modification” message, it forwards its local copy to the client. If modification had been there, the Cache forwards the new object, whilst storing it locally along with the date and time it received the new object (so that it can ask the original server later for modifications).
For obvious reasons, an HTTP 304 message does not contain a message body.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Web 1.0, Web 2.0 and Web 3.0 with their difference
- Difference between Deep Web and Dark Web
- Difference between continue and break statements in C++
- Automatic Resource Management in Java | try with resource statements
- SQL | Conditional Expressions
- CSS | Conditional Rules
- C program to check if a given year is leap year using Conditional operator
- Python program to crawl a web page and get most frequent words
- What’s difference between The Internet and The Web ?
- Web technologies | HTML and XML | Question 1
- LocalStorage and SessionStorage | Web Storage APIs
- Internet and Web programming
- Introduction to Web Development and the Holy Trinity of it
- The Internet and the Web
- Difference between Static and Dynamic Web Pages
- Web Browsers that support Java Applets and how to enable them
- Dark Web Analytics and Interesting Facts Behind its Anonymity
- Difference between WCF and Web API
- Difference between Windows application and Web application
- Difference between AngularJs and Google Web Toolkit (GWT)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.