Headers Flashcards
What are headers?
They’re like metadata tags that get sent along with HTTP requests and responses.
They provide information about the data being transferred, how to handle it, and various control parameters for the communication.
What is the Content-Type header for?
Tells the receiver what kind of data is being sent: text/html, aplication/json, image/jpeg, etc.
What is the Authorization header for?
Used to sent credentials and tokens for authentication. It often starts with Basic or Bearer, followed by the authentication token.
What is the Accept header for?
Indicates what types of content the client can understand. For example, a browser might send “Accept: text/html,application/json” to say it can handle both HTML and JSON responses.
What is the Cache-Control header for?
Defines caching policies like how long to store the response, whether to use cached version, etc.
What is the Origin header used for?
Indicates where the request originated from, use in cross-origin resource sharing to help prevent unauthorized access from different domains.
What is the User-Agent header for?
Identifies the client making the request, typically including information about the browser and operating system.
What is the Cookie header for?
Contains stored session information and user preferences that the browser sends to the server with each request.