Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

standard http headers

HeaderExampleDescription
A-IMA-IM: feedInstance manipulations that are acceptable in the response. Defined in RFC 3229
AcceptAccept: application/jsonThe media type/types acceptable
Accept-CharsetAccept-Charset: utf-8The charset acceptable
Accept-EncodingAccept-Encoding: gzip, deflateList of acceptable encodings
Accept-LanguageAccept-Language: en-USList of acceptable languages
Accept-DatetimeAccept-Datetime: Thu, 31 May 2007 20:35:00 GMTRequest a past version of the resource prior to the datetime passed
Access-Control-Request-MethodAccess-Control-Request-Method: GETUsed in a CORS request
Access-Control-Request-HeadersAccess-Control-Request-Headers: origin, x-requested-with, acceptUsed in a CORS request
AuthorizationAuthorization: Basic 34i3j4iom2323==HTTP basic authentication credentials
Cache-ControlCache-Control: no-cacheSet the caching rules
ConnectionConnection: keep-aliveControl options for the current connection. Accepts keep-alive and close. Deprecated in HTTP/2
Content-LengthContent-Length: 348The length of the request body in bytes
Content-TypeContent-Type: application/x-www-form-urlencodedThe content type of the body of the request (used in POST and PUT requests)
CookieCookie: name=valuehttps://flaviocopes.com/cookies/
DateDate: Tue, 15 Nov 1994 08:12:31 GMTThe date and time that the request was sent
ExpectExpect: 100-continueIt’s typically used when sending a large request body. We expect the server to return back a 100 Continue HTTP status if it can handle the request, or 417 Expectation Failed if not
ForwardedForwarded: for=192.0.2.60; proto=http; by=203.0.113.43Disclose original information of a client connecting to a web server through an HTTP proxy. Used for testing purposes only, as it discloses privacy sensitive information
FromFrom: user@example.comThe email address of the user making the request. Meant to be used, for example, to indicate a contact email for bots.
HostHost: flaviocopes.comThe domain name of the server (used to determined the server with virtual hosting), and the TCP port number on which the server is listening. If the port is omitted, 80 is assumed. This is a mandatory HTTP request header
If-MatchIf-Match: β€œ737060cd8c284d8582d”Given one (or more) ETags, the server should only send back the response if the current resource matches one of those ETags. Mainly used in PUT methods to update a resource only if it has not been modified since the user last updated it
If-Modified-SinceIf-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMTAllows to return a 304 Not Modified response header if the content is unchanged since that date
If-None-MatchIf-None-Match: β€œ737060cd882f209582d”Allows a 304 Not Modified response header to be returned if content is unchanged. Opposite of If-Match.
If-RangeIf-Range: β€œ737060cd8c9582d”Used to resume downloads, returns a partial if the condition is matched (ETag or date) or the full resource if not
If-Unmodified-SinceIf-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMTOnly send the response if the entity has not been modified since the specified time
Max-ForwardsMax-Forwards: 10Limit the number of times the message can be forwarded through proxies or gateways
OriginOrigin: http://mydomain.comSend the current domain to perform a CORS request, used in an OPTIONS HTTP request (to ask the server for Access-Control- response headers)
PragmaPragma: no-cacheUsed for backwards compatibility with HTTP/1.0 caches
Proxy-AuthorizationProxy-Authorization: Basic 2323jiojioIJOIOJIJ==Authorization credentials for connecting to a proxy
RangeRange: bytes=500-999Request only a specific part of a resource
RefererReferer: https://flaviocopes.comThe address of the previous web page from which a link to the currently requested page was followed.
TETE: trailers, deflateSpecify the encodings the client can accept. Accepted values: compress, deflate, gzip, trailers. Only trailers is supported in HTTP/2
User-AgentUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36The string that identifies the user agent
UpgradeUpgrade: h2c, HTTPS/1.3, IRC/6.9, RTA/x11, websocketAsk the server to upgrade to another protocol. Deprecated in HTTP/2
ViaVia: 1.0 fred, 1.1 example.com (Apache/1.1)Informs the server of proxies through which the request was sent
WarningWarning: 199 Miscellaneous warningA general warning about possible problems with the status of the message. Accepts a special range of values.
DntDNT: 1If enabled, asks servers to not track the user
X-CSRF-TokenX-CSRF-Token: Used to prevent CSRF