Cookies
👋Hello online friends! Let’s talk about cookies
⏺ HTTP is a stateless protocol. This means that when two requests arrive at the server, it does not understand whether they were sent by one client or different ones. In real applications, you constantly need to identify the user: check if he is authorized, display user recommendations, store a basket of selected products in the store. There is a Cookies mechanism for this.
⏺ Cookies are a piece of data in which the server transmits important information about the client. The browser receives this fragment, saves it, and sends it back to the server with each subsequent request. So he understands from which client the request came.
⏺ Cookies look like a key=value pair. To set them, the server must send a Set-Cookie header with a value in response to a client request.
Set-Cookie: token=123abc
đź‘‹
⏺ The cookie example that we indicated in the previous post is a session cookie , they do not have expiration dates . It will exist until the user closes the tab with the site in the browser. But many browsers use a session recovery mechanism, so session cookies can theoretically live forever.
⏺ Cookies usually have a fixed lifetime. This can be done in two ways:
⬜️ Set expiration date — Expires .
⬜️ Set the number of seconds after which the cookie will no longer be relevant — MAX_AGE .
⏺ Here is an example of a cookie that should expire on January 1, 2030:
Set-Cookie: token=123abc; Expires=Tue, 01 Jan 2030 00:00:00 -0000
đź‘‹
⏺ The domain and path parameters control the scope of the cookie and determine on which subdomains and for which URLs they will work. If you don’t specify the domain parameter, it will default to the host of the site, such as example.com .
Then cookies won’t work for subdomains like test.example.com . If you specify a domain value, then the cookie will work for the host and all subdomains.
⏺ The path parameter specifies which URLs to send the cookie in the header when requesting resources. If you set path=/ then cookies will be sent for all requests. If you specify the path=/api value, then they will be passed for all requests for resources whose URL begins with /api.
Let’s expand on the previous example:
Set-Cookie: token=123abc; expires=Thu, 05 Aug 2021 18:45:00 -0000; max_age=120; domain=example.com; path=/api
We Got More Tools For #Price
#Update #tutorial #rianews #software #hardware #technology #money #earning #ipmc #love #giveaways #computing #computers #informationtechnology #learning #AI #redfishiaven #servers #deepweb #darkweb #bitcoin
See REDFISH IA VEN ( https://goo.gl/maps/LVKkEYNN2LTe9C34A ) in Google Maps.
https://www.youtube.com/channel/UC6k_cFigPCSEtRyALo1D-tA
Be the First To Know About The New #software