You are on page 1of 4

7/4/2017 HTTPHeaders|HttpWatch

(/)

HTTP Gallery

Jump to ...

2. HTTP Headers
Headers are name/value pairs that appear in both request and response messages. The name of the header is separated from the value by a
single colon. For example, this line in a request message:

UserAgent:Mozilla/5.0(WindowsNT6.3;WOW64;Trident/7.0;rv:11.0)likeGecko

provides a header called User-Agent whose value is Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1). The purpose of this particular
header is to supply the web server with information about the type of browser making the request. A complete denition of this and other
commonly encountered HTTP headers can be found in the HTTP 1.1 specication (http://www.w3.org/Protocols/rfc2616/rfc2616.html).

Some web applications use custom headers to add comments or annotations to an HTTP message. The convention is to prex the header name
with X- to indicate that it is non-standard. In the previous example, the HTTP response message from this web server set an X-AspNet-Version
header to indicate which version of ASP.NET it is running.

Example 2
Clicking the Get Current Time button requests an updated copy of the following image:

GET CURRENT TIME

Using HttpWatch with Example 2

To view the HTTP headers discussed on this page:

1. Open HttpWatch by right clicking on the web page and selecting HttpWatch from the context menu

2. Click on Record to start logging requests in HttpWatch

3. Click on the Get Current Time button above

4. Select the single entry displayed and go to the Headers tab

The Headers tab will show two lists of headers; the one on the left is for the request message and the one on the right for the
response message.

2.1 Request Headers


HTTP clients use headers in the request message to identify themselves and control how content is returned. If you are using IE, you will have
seen the following headers sent with the request in Example 2:

Accept:*/*

https://www.httpwatch.com/httpgallery/headers/ 1/4
7/4/2017 HTTPHeaders|HttpWatch
This header indicates that the browser will accept all types of content.

AcceptLanguage:engb

The browser prefers British English content.

AcceptEncoding:gzip,deflate

The browser can handle gzip or deate compressed content

Connection:KeepAlive

The browser is requesting the use of persistent TCP connections.

Host:www.httpwatch.com

HTTP/1.1 requires that the host name is supplied with every request so that multiple domains can be hosted on a single IP address.

Referer:http://www.httpwatch.com/httpgallery/headers/

This is supplied by the browser to indicate if the current request was the result of a link from another web page. The server may use this
information to gather usage statistics or to track which web sites have links to a page.

UserAgent:Mozilla/5.0(WindowsNT6.3;WOW64;Trident/7.0;rv:11.0)likeGecko

This identies the browser is Internet Explorer Version 11 running on Windows 8.1 x64

2.2 Response Headers


HTTP servers use headers in the response message to specify how content is being returned and how it should be handled. If you are using IE,
you will have seen the following headers returned with the image in Example 2:

CacheControl:nocache

This header indicates whether the resource may be cached by the browser or any immediate caches. The value no-cache disables all caching.
(See 5. Caching for more information (../caching/))

ContentLength:2748

This header contains the length in bytes of the resource (i.e. the gif image) that follows the headers.

ContentType:image/gif

The content is in GIF format.

Date:Wed,4Oct200412:00:00GMT

https://www.httpwatch.com/httpgallery/headers/ 2/4
7/4/2017 HTTPHeaders|HttpWatch
This is the current date and time on the web server.

Expires:1

The Expires header species when the content should be considered to be out of date. The value -1 indicates that the content expires
immediately and would have to be re-requested before being displayed again.

Pragma:nocache

The browser may be connecting to the server via HTTP/1.0 proxies or caches, that do not support the Cache-Control header. Setting Pragma to
no-cache header prevents HTTP/1.0 caches from storing the content.

Server:MicrosoftIIS/6.0

The web server is an IIS 6 web server.

XAspNetVersion:4.0.30319

The web server is running ASP.NET 4.0

XPoweredBy:ASP.NET

The web server is running ASP.NET.

<1. INTRODUCTION (../INTRODUCTION/) 3. STATUS CODES> (../ERRORS/)

Ready to get started?

TRY FOR FREE

(/DOWNLOAD/)
BUY NOW (/BUY/)

HttpWatch
Features (/features/httpdebugger.aspx)
Compare Editions (/editions.aspx)
New in Version 10.x (/newin10x.aspx)
Download (/download/)
Pricing (/buy/)

Our Customers
Who is using it? (/#customers)
What are they saying? (/#quotes)

Learning & Documentation


HttpWatch Blog (http://blog.httpwatch.com)
HTTP Gallery (/httpgallery/)
HttpWatch Help (http://help.httpwatch.com)

HttpWatch Automation Reference (http://apihelp.httpwatch.com)


https://www.httpwatch.com/httpgallery/headers/ 3/4
7/4/2017 HTTPHeaders|HttpWatch
HttpWatch Automation Reference (http://apihelp.httpwatch.com)

Support
Technical Support (/support/)
About Us (/company/)
Contact Us (/company/)
Blog (http://blog.httpwatch.com)
Twitter (https://twitter.com/httpwatch)

Search (/search/) Terms & Conditions (/company/terms.aspx) Privacy Policy (/company/privacy_policy.aspx) Copyright (/company/copyright.aspx)

Copyright 2017 Neumetrix Limited (/)

https://www.httpwatch.com/httpgallery/headers/ 4/4

You might also like