Junior
What keys are transmitted from the server to the client?
sobes.tech AI
Answer from AI
The main keys transmitted from the server to the client are used in HTTP caching mechanisms:
Cache-Control: Manages caching behavior on both the client side and proxy servers. Indicates whether a resource can be cached, its maximum age (max-age), the need for revalidation (no-cache), cache prohibition (no-store), and other directives.Expires: Specifies the exact date and time after which the cached resource is considered stale. It is deprecated compared toCache-Control: max-age.ETag: A unique identifier for the resource version. Used by the client in theIf-None-Matchheader during subsequent requests to verify the freshness of the cached copy. If theETagon the server matches the one sent by the client, the server returns a304 Not Modifiedstatus.Last-Modified: The date and time of the last modification of the resource. Used by the client in theIf-Modified-Sinceheader for the same purpose asETag. If the resource has not been modified since the specified date, the server returns304 Not Modified.
In addition to caching, keys related to security and session management can be transmitted:
Set-Cookie: Sets a cookie on the client side. Contains the cookie name, value, domain, path, expiration, flags (HttpOnly,Secure,SameSite).Strict-Transport-Security(HSTS): Instructs the browser that access to the domain should only be via HTTPS for a specified period.Public-Key-Pins(HPKP - deprecated): Instructed the browser which public keys should be associated with the domain. Used to prevent MITM attacks using fake certificates. Deprecated and not recommended for use.