To send cookies to the server, you need to add a "Cookie: name = value" request header. To send multiple Cookies in one cookie header, you can separate them with semicolons. In this example, we are sending HTTP cookies in the request header to the Reqbin echo URL. Click Send to execute "Send Cookies" online and view the results.
The Hypertext Transfer Protocol is the data transfer protocol that underlies the World Wide Web. HTTP transfers data between HTTP clients (browsers and mobile apps) and servers. HTTP is based on client-server technology. HTTP works as a request-response protocol between client and server. The client sends a request and initiates a connection, and the server receives the request, then executes it and sends the result to the client.
What is Cookie?
HTTP Сookies are small pieces of text data sent by a website and stored on a user's computer by a web browser. The data stored in the cookie is created by the server when you connect. This data is tagged with an identifier that is unique to you and your computer. When your computer and the network server exchange cookies, the server reads the identifier and knows what information to give you specifically. The browser sends cookies back to the server with each subsequent request, allowing the server to determine if the request came from the same browser or not. Cookies are primarily used to manage user sessions, track users and personalize (store user preferences and site settings).
Previously, Cookies were used for client-side shared storage. This made sense when Cookies were the only way to store data on the client. Modern storage APIs such as web storage APIs (localStorage and sessionStorage) and IndexedDB are now recommended. Cookies are sent with every request so that they can degrade performance (especially for mobile data connections.
Cookies are mainly used for three purposes:
Session management: Logins, passwords, or whatever the server needs to remember
Personalization: Custom settings, themes, and other settings
Tracking: Recording and analysis of user behavior
How to see saved Cookies in the browser?
To view the saved cookies and other storage that a web page can use, you can enable the storage inspector (F12) in the developer tools, select the Application section, and select Сookies in the storage tree.
How to send Cookies?
An example of sending Cookies header that we send to the ReqBin echo URL:
Send Cookies Example
GET /echo HTTP/1.1
Cookie: name=value; name2=value2