http-headers tagged requests and articles

Categorized request examples and articles tagged with [http-headers] keyword
Curl CORS Request
An example of sending a Curl request with the CORS Origin header (Cross-Origin Resource Sharing request). For CORS requests, the Origin header indicates where the request is coming from. In this Curl CORS Request example, the Origin header is passed to the server with the -H "Origin:" command-line option.

CORS Request with Credentials
An example of sending a CORS request with an Origin header and an authorization cookie. In this CORS Request with Credentials example, the Origin is provided with "Origin:" request header, and the cookie is provided with the "Cookie: authCookie=my_auth_cookie" header.

Curl Add Header
An example of adding a header to the Curl request. Use the -H command-line option to set the Curl header details. In this Curl Add Header example, the -H "Content-Type: application/json" command-line option indicates the media type of the resource, and the Accept: application/json header tells the server that the client expects JSON.

HTTP Headers
The browser and server use HTTP headers to pass the information on data size and type, compression methods, languages, cache directives, and origin.

Content-Type Header
The Content-Type HTTP header is used to indicate the type of media in the body of the message.

Cross-Origin Resource Sharing (CORS)
Cross-Origin Resource Sharing (CORS) is a mechanism that provides secure communication between browsers and servers running on different origins (on different hostnames or protocols) using additional HTTP headers.

Connection Header
The Connection HTTP header controls whether the current network connection remains open after the transaction.

Content-Length Header
The Content-Length HTTP header is used to indicate the size of the message body, in decimal number of OCTETs. The Content-Length header is used to let the receiving party know when the current message has ended, so the connection can be closed or reused for another request.

Content-Encoding Header
The Content-Encoding header is used by the server to tell the client which encoding is applied to the message body. The content encoding is mainly used for a document compression that will not lead to data loss, save bandwidth and speed up the website.

Common HTTP Headers
The list of common HTTP headers.

The HTTP CONNECT method is used to create an HTTP tunnel through a proxy server.

Cache-Control Header
The Cache-Control HTTP header is used to specify cache conditions and duration for both requests and responses. Resources can define their own caching policy via the Cache-Control HTTP header.

Transfer-Encoding Header
The Transfer-Encoding header specifies the form of encoding used to safely transfer the entity over the network.

Response Header: Set-Cookie
The Set-Cookie HTTP response header sends cookies from the server to the user agent. A server sends a Set-Cookie header with the response when it receives an HTTP request.

Pragma Header
The Pragma header provides backward compatibility with HTTP/1.0 clients. It is mainly used for cache management and tells the server and intermediate caches that it needs a fresh version of the resource.

HTTP Caching
Caching is a technique used to reduce latency and network traffic by storing a copy of a given resource and serving it back when requested.

Set-Cookie Header
The server sends cookies to the browser by adding the "Set-Cookie: cookie-name = cookie-value" HTTP header to the response. The browser saves cookies on the user's computer, and then sends them back to the server by adding the "Cookie: saved-cookie" header to the request.

General Header: Date
Date is a general HTTP header that contains the date and time the message was sent.