সাধারণ HTTP হেডার

HTTP হেডার হল কী-ভ্যালু জোড়া যা প্রতিটি অনুরোধ ও প্রতিক্রিয়ার শুরুতে পাঠানো হয়। এতে কনটেন্টের ধরন, ক্যাশে নিয়ম এবং প্রমাণীকরণের মতো মেটাডেটা থাকে। ওয়েব ট্রাফিক তৈরি বা ডিবাগ করার সময় সবচেয়ে সাধারণ হেডার চেনার জন্য এই শিট ব্যবহার করুন।

আপডেট করা হয়েছে:

হেডারদিককাজ
HostrequestIdentifies the server's host and port (from the URL).
User-AgentrequestReports the client software (browser, OS, bot) making the request.
AcceptrequestLists the response media types (MIME) the client can handle.
AuthorizationrequestCarries credentials (token, Basic auth) to authenticate the client.
Content-Typerequest/responseStates the media type of the request or response body.
Content-Lengthrequest/responseGives the size in bytes of the request or response body.
CookierequestSends stored key/value pairs from a previous response back to the server.
Set-CookieresponseServer instructs the client to store a cookie for later requests.
Cache-Controlrequest/responseDirects caching behaviour: no-cache, max-age, private, etc.
ETagresponseOpaque identifier for a resource version, used for revalidation.
If-None-MatchrequestSends an ETag; server returns 304 if the resource is unchanged.
LocationresponsePoints the client to a new URL for redirects (3xx) or created resources.
Access-Control-Allow-OriginresponsePermits a browser to share a response across origins (CORS).
X-Forwarded-ForrequestRecords the client IP as seen through a proxy or load balancer.
RefererrequestIndicates the URL of the page that linked to the requested resource.

নোট

সচরাচর জিজ্ঞাসা

অনুরোধ ও প্রতিক্রিয়া হেডারের মধ্যে পার্থক্য কী?
অনুরোধ হেডার ক্লায়েন্ট (ব্রাউজার বা অ্যাপ) থেকে সার্ভারে পাঠানো হয়; প্রতিক্রিয়া হেডার সার্ভার তার উত্তরের সঙ্গে ফেরত দেয়। Content-Type-এর মতো কিছু দুই পাশেই থাকে।
HTTP হেডারের নাম কি ছোট-বড় হাতের প্রতি নির্ভরশীল?
না। বিধি অনুযায়ী হেডার নাম কেস-সেনসিটিভ নয়, তাই Content-Type ও content-type একই। Title-Case কেবল একটি রীতি।
Host হেডার কী করে?
Host সার্ভারকে বলে অনুরোধটি কোন ডোমেইনের জন্য। HTTP/1.1-এ এটি বাধ্যতামূলক এবং একটি সার্ভার নাম অনুযায়ী একাধিক সাইট হোস্ট করতে পারে।
হেডার দিয়ে ক্যাশে কীভাবে কাজ করে?
Cache-Control বলে দেয় উত্তর কতক্ষণ ক্যাশে রাখা যাবে; ETag ও If-None-Match দিয়ে ক্লায়েন্ট জিজ্ঞাসা করে 'বদলেছে?' এবং অপরিবর্তিত হলে হালকা 304 Not Modified পায়।