There is no way you can skip cookies if you are a developer. A cookie is today as important in internet as any language. Cookies has made our way simpler and better, both for the developer and the user. So in this chapter we will focus on.
What is a cookie?
Cookie in simpler terms means just the textual information about some website. When you visit a particular website, some information is saved in your local system so that when you visit the same website again, this website is able to recognize you and show you the results according to your preferences. Cookies have been long used in the internet history and have developed in a magnificent way.Â
When you visit a website you actually requests the web page from the server. For a server, every request is a unique request. So if you visit hundred times, the server will consider each and every request unique. Since the intensity of requests that arrive at a server is high, it is obvious and logical not to store every user’s information to the server. Maybe you never visit again and the same information will be redundant. So, to uniquely remember you, the server sends the cookies along with the response which is saved in your local machine. Now the next time you hit the same server, you will get a response according to you as the server will recognize you.
This cookie is unique to every server (some exceptions exist today because of advertisements). So you might have many cookies in your system but a server will recognize it’s own cookie and can analyse it for you. How this evolved over time and used today is discussed in the next section.
Why to use cookies?
Cookies developed in the initial days because developers needed some information about the client to make their experience better. Let say you visit a website which is not in your local language (let’s say English). You choose the English option in the language section of the website. Now if you visit the same website 5 times a day, you might have to change the language 5 times. Therefore, this information is saved as a cookie in your system. So the next time you send the request, the server will know that you want to see the website in english. This is where cookies play a vital role. But this is a very minute example of the scale cookies are used today.
Advancement of cookies:
The concept of cookies was developed for creating a better experience by saving little information as texts on the client’s machine. But as the concept became more and more demanding and successful, the usage of cookies increased many folds. Today, cookies are used from what you searched to even what you saved in your cart. Cookies are used today at an extreme level saving your information about various websites. Knowing this, it is obvious that the size of the information has increased. So developers have recognized that all the information cannot be saved in the client’s machine as it will increase the cookie size which is sent with requests and also will load the client’s machine. Therefore cookies are now saved in a different way.
Now, if you visit a website, the website provide you with a cookie id which is uniquely recognizable by the server. This id is then linked to the database of the company where all your information is saved and then fetched from the database. This way cookies can be managed more efficiently and more securely.
Security threats related to Cookies:
Cookies as you must have come to know till now, saves your information to your machine. This information is highly personal to you and should only be retrieved by the server which saved it. Does it possess any security threats? Fortunately no. The following things should be kept in mind:
- A cookie cannot be used by any other server as the id saved in your cookie is directly mapped to the website’s database.
- A cookie can never be used to access any information saved in your system, browser or hard disk.
- A cookie cannot be used to deliver viruses or any other threats.
- A cookie but can be used by a third website (with permissions of course) to access the information and/or your preferences to use them for their and your benefit. To understand it a bit more, we should understand the types of cookies.
Refer for – How cookies are used in a website?
Similar Reads
What is Port 80?
Whenever someone tries to access a website and its content then the port 80 is used for that purpose but how does the computer know it needs to use the port 80? and how is data sent to the browsers using this port. For that, we need to understand what is port 80. What is Port 80?Whenever we go to a
5 min read
Cross Origin Resource Sharing (CORS)
CORS (Cross-Origin Resource Sharing) is a mechanism by which data or any other resource of a site could be shared intentionally to a third party website when there is a need. Generally, access to resources that are residing in a third party site is restricted by the browser clients for security purp
3 min read
How slow HTTP can knock down a server?
Slow HTTP are application layer Denial Of Service (DoS) attacks and have a potential to knock down a server with limited resources. Because of the nature of the attack (slow speed and low volume), they are hard to detect and can cause equal damage as a high volume DDoS. In this post, Iâll share my e
4 min read
How to make sure that Apache service keeps running in Ubuntu
Majority of world's websites are hosted on are hosted on Apache Web Servers and the majority of those servers run Apache in Linux. Let's see how to install Apache in Ubuntu: Type the following commands in terminal application on your computer: $ sudo apt-get update $ sudo apt-get install apache2 Now
2 min read
curl Command in Linux with Examples
In the realm of Linux, mastering the command line is essential for efficient and powerful usage of the operating system. Among the number of command line tools available, `curl` stands out as one of the most versatile and powerful utilities. Originally developed by Daniel Stenberg, `curl` is a comma
6 min read
Lex Program For checking a valid URL
Problem: Write a Lex program for checking a valid URL. Explanation: Lex is a computer utility that generates some lexical analyzers. Lex reads a stream of characters as input specifying the lexical analyzer and give source code as the output implementing the lexer in the C programming language. Prer
1 min read
Why HTTP is not Secure ?
HTTP, short for Hypertext Transfer Protocol, is a standard protocol used for data transfer on the World Wide Web. It prescribes how data should be transferred between your web browser and the server, but it has no security features, leaving it vulnerable to a large number of cyber threats, such as d
6 min read
Components of a URL
If you are SpongeBob then your URL is Bikini Bottom on the floor of the Pacific Ocean but if youâre not, your URL is definitely the address of the house you live in! URL stands for Uniform Resource Locator. For a website, a URL is basically where the website lives online and it helps visitors to ide
3 min read
What is HTTP/2?
HTTP/2 is the new version of HTTP, which transfers data over the Web. HTTP/2 is important for transmitting data from client to server over the web. Over time, various developments were made to enhance web protocols' efficiency, performance, and safety. HTTP/2 provides various features to transmit da
4 min read
Understanding HTTP using Browsers
For understanding what is HTTP and how does it work we need to first understand how the Web Server works and requests go to the server and how the server responds to that request after that we will be able to understand what is HTTP. HTTP : HTTP is a client-server protocol that means when a request
4 min read