Yaygın HTTP başlıkları

HTTP başlıkları, her istek ve yanıtın başında gönderilen anahtar-değer çiftleridir. İçerik türü, önbellek kuralları ve kimlik doğrulama gibi meta veriler taşırlar. Web trafiği oluştururken veya hatalarını ayıklarken en sık gördüğünüz başlıkları tanımak için bu sayfayı kullanın.

Güncellendi:

BaşlıkYönAmaç
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.

Notlar

Sık sorulan sorular

İstek ve yanıt başlığı arasındaki fark nedir?
İstek başlıklarını istemci (tarayıcı veya uygulama) sunucuya gönderir; yanıt başlıklarını sunucu cevabıyla birlikte döndürür. Content-Type gibi bazıları her iki tarafta da görünür.
HTTP başlık adları büyük/küçük harfe duyarlı mı?
Hayır. Spesifikasyona göre başlık adları harf büyüklüğüne duyarlı değildir; Content-Type ile content-type aynı şeyi ifade eder. Title-Case yalnızca bir konvansiyondur.
Host başlığı ne işe yarar?
Host, isteğin hangi domain'i hedeflediğini sunucuya söyler. HTTP/1.1'de zorunludur ve bir sunucunun çok sayıda siteyi ada göre barındırmasını sağlar.
Başlıklarla önbellekleme nasıl çalışır?
Cache-Control bir yanıtın ne kadar önbelleğe alınabileceğini belirler; ETag ve If-None-Match istemcinin 'değişti mi?' diye sormasını ve ucuz bir 304 Not Modified almasını sağlar.