Start of change

Writing HTTP headers for a response

For dynamic responses created by application programs, CICS® automatically provides the HTTP headers that are required for basic messages, depending on the HTTP protocol version used for the message. You might need to add further HTTP headers to your response.

Some HTTP headers are created automatically by CICS if the message requires them. Your application does not need to write these headers. The full list of headers created by CICS is:
  • Connection
  • Content-Length
  • Start of changeContent-Type (written by CICS, but can be supplied by a client application if a complex header is required)End of change
  • Date
  • Expect
  • Host
  • Server
  • TE (written by CICS, but the application can add further instances)
  • Transfer-Encoding
  • User-Agent
  • WWW-Authenticate
Note that some of these headers are appropriate, and created, only when CICS is an HTTP client. The circumstances in which these headers are created are described in HTTP header reference for CICS Web support. If you do write these headers on a response, CICS does not overwrite them, but uses the versions provided by your application.
The headers that CICS provides when a response is sent are the ones that should normally be written for a basic message to be compliant with the appropriate HTTP protocol specification. You might want to add further HTTP headers to the response for purposes such as:
  • Control of caching and document expiry (for example, Cache-Control, Expires, Last-Modified)
  • Content negotiation (for example, Accept-Ranges, Vary)
  • Information for the Web client (for example, Title, Warning, further Content headers)
If your application program is performing complex actions, or if you select certain status codes for your response, the HTTP specification to which you are working is likely to require the use of particular HTTP headers for your message. When you add any HTTP headers to a response, check the HTTP specification to which you are working for any important requirements that apply to those headers. See The HTTP protocol for more information about the HTTP specifications.

Write additional HTTP headers for a message before you issue the WEB SEND command to send the message. The exception to this rule is if you are writing headers to be sent as trailing headers on a chunked message, in which case the special process mentioned below applies. When writing HTTP headers for a response:

End of change