HTTP headers kya hote hai? Explained in simple Hindi
HTTP headers, HTTP (Hypertext Transfer Protocol) mein communication ke dauran use hone wale metadata pieces hote hain. Ye headers HTTP request ya response ke sath associated hote hain aur additional information provide karte hain. Har header ek key-value pair hota hai jisme key aur value ke darmiyaan colon `:` hota hai.
Kuch common HTTP headers include:
1. Host:
- Specifies the domain name of the server (e.g., `Host: www.example.com`).
2. User-Agent:
- Identifies the user agent (e.g., browser) making the request (e.g., `User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36`).
3. Content-Type:
- Describes the type of data in the body of the request or response (e.g., `Content-Type: application/json`).
4. Content-Length:
- Specifies the length (in bytes) of the body content in the request or response (e.g., `Content-Length: 1024`).
5. Authorization:
- Contains credentials for authenticating the client with the server (e.g., `Authorization: Basic base64encodedcredentials`).
6. Accept:
- Indicates the media types that the client can understand, typically used in the request (e.g., `Accept: text/html,application/xhtml+xml,application/xml; q=0.9,image/webp,image/apng,*/*;q=0.8`).
7. Location:
- In a response, it indicates a redirect location (e.g., `Location: /new/page`).
8. Cookie:
- Contains information about previously set cookies (e.g., `Cookie: sessionId=abc123`).
9. Server:
- Specifies information about the software running the server (e.g., `Server: Apache/2.4.29`).
10. Date:
- Represents the date and time at which the message was sent (e.g., `Date: Tue, 26 Jan 2024 12:30:45 GMT`).
Ye headers communication process ko control karte hain aur client-server interaction ke various aspects ko define karte hain. Headers HTTP request aur response dono mein hote hain, lekin specific headers request aur response ke context mein alag ho sakte hain.