Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

FAQ: Frequently Asked Questions about CGI Programming
Section - 2.5 What HTTP response headers do I need to know about?

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Airports ]


Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 2.4 Why doesn't my script get REMOTE_USER? My page is password-protected.
Next Document: 2.6 What is NPH?
See reader questions & answers on this topic! - Help others by sharing your knowledge

Unless you are using NPH, the HTTPD will insert necessary response
headers on your behalf, always provided it is configured to do so.

However, it is conventional for servers to insert the Content-Type header
based on a page's filename, and CGI scripts cannot rely on this.  Hence
the usual advice is to print an explicit Content-Type header.
At least one of "Content-Type", "Status" and "Location" is almost
always required.

A few other headers you may wish to use explicitly are:
Status		(to set HTTP return code explicitly.   Caveats:
		   (1) Behaviour is undefined if it conflicts with
		   another header. (2) This is NOT an HTTP header.)
Location	(to redirect the user to another URI, which may or may
		not be on your own server)
Set-cookie	(Netscape/Nonstandard) Set a cookie
Refresh		(Netscape/Nonstandard) Clientpull

You can also use general MIME headers: eg "Keywords" for the benefit of
indexers (although in this instance some major search robots have
regrettably introduced a new protocol to do the same thing).

For a detailed reference, see RFC1945 (HTTP/1.0) or RFC2068 (HTTP/1.1).


User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 2.4 Why doesn't my script get REMOTE_USER? My page is password-protected.
Next Document: 2.6 What is NPH?

Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
Nick Kew <nick@webthing.com>





Last Update March 27 2014 @ 02:12 PM