Start of change

Redirecting HTTP requests to another URL

You can redirect an HTTP request for CICS® as an HTTP server to another URL using a URIMAP definition.

You might intend that the resource should always be provided by redirecting the Web client to another URL. Alternatively, you might want to use redirection to provide a temporary response to a request while the intended resource is unavailable (for example, a page telling the requester that the application they need is offline). In either case, you can redirect the request using a URIMAP definition that matches the request, as follows:
  1. Locate the URIMAP definition for the URL that you want to redirect.
  2. Use the LOCATION attribute of the URIMAP definition to specify a URL of up to 255 characters, to which matching HTTP requests are redirected. This must be a complete URL, including scheme, host and path components. Include all the delimiters. CICS checks that the URL is complete and correctly delimited, but CICS does not check that the destination is valid.
    1. Start of changeOptional: You can use a fragment identifier (preceded by a # character) in the LOCATION attribute, to point a Web browser to a reference or function within the item identified by the URL. For example, a fragment identifier can be the ID of a subsection within a document. Consult the technical specification for the type of content that you are providing (for example, HTML) to see whether and how fragment identifiers can be used.End of change
  3. Use the REDIRECTTYPE attribute of the URIMAP definition to specify temporary or permanent redirection. When requests are redirected on a temporary basis, the HTTP status code used for the response is 302 (Found). When requests are redirected permanently, the HTTP status code used for the response is 301 (Moved Permanently). CICS composes the redirection response, and it cannot be customized.
  4. Install the changed URIMAP definition. When REDIRECTTYPE(TEMPORARY) or REDIRECTTYPE(PERMANENT) is specified, the LOCATION attribute of the URIMAP definition overrides any other attributes in the URIMAP definition, and redirects the HTTP requests. You can use the SET URIMAP LOCATION command to change the LOCATION attribute after the URIMAP definition is installed.
  5. If and when the resource becomes available again, use the command SET URIMAP REDIRECTTYPE(NONE) to switch off redirection, and re-install the changed definition. The URL specified in the LOCATION attribute is retained, but is not used unless you reactivate redirection.
End of change