Cookie-related HTTP headers
there are two HTTP headers and cookies about: Set-cookie and cookies. Set-cookie is sent by the server, which is included in the header of the response request. It is used to create a cookie on the clientThe cookie header is sent by the client and is included in the header of the HTTP request. Note that only the domain and path of the cookie match the requested URL to send this cookie.
Set-cookie Headerthe format of the Set-cookie response header is as follows:
Set-cookie: <name>=<value>[; <name>=<value>] ...[; expires=<date>][; Domain=<domain_name>][; path=<some_path>][; secure][; HttpOnly]
Expires=<date>: Sets the period of validity of the cookie, which expires if the cookie exceeds the date indicated by date. If this option is not set, then the cookie will expire when the browser is closed. Note: Date is Greenwich mean GMT (GMT) and is expressed in the following format:
Day, DD MMM YYYY HH:MM:SS GMT Day of the the week (Sun, Mon, Tue, Wed, Thu, Fri, Sat). DD the day in the month (such as to the first day of the month). MMM the three-letter abbreviation for the month (Jan, Feb, Mar, APR, May, June, Jul, Mar, Sep, Oct, Nov, Dec). YYYY the year . HH The hour value in military time (would is 10:00am, for example). MM the minute value. SS the second value.
domain=<domain_name>:Path=<some_path>:Note: Temporary cookies (cookies without expires parameters) cannot be accompanied by the domain option. when a client sends an HTTP request, a valid cookie is sent to the server along with it. if the domain and path parameters of a cookie match the URL, the cookie is valid.
A URL contains domain and path, you can refer to the http://www.w3school.com.cn/html/html_url.asp
Secure: Indicates that the cookie can only be sent to the HTTP server. HttpOnly: Indicates that the cookie cannot be obtained by client script.
HTTP Cookie header in Set-cookie format