[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Single Page

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?


2.5 What HTTP response headers do I need to know about?



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).




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 | Search | Web FAQs | Documents | RFC Index ]

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

Last Update December 05 2008 @ 00:13 AM

© 2008 FAQS.ORG. All rights reserved.