Redirecting HTTP requests to another URL

You can redirect, temporarily or permanently, an HTTP request for CICS® as an HTTP server to another URL by using a URIMAP definition.

About this task

You can use redirection to ensure that requests are always processed by redirecting the web client to another URL. Alternatively, you can 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 requested is offline. In either case, you specify redirection with the LOCATION and REDIRECTTYPE attributes of a URIMAP resource.

You can specify these attributes when you create the URIMAP, and you can change them while the URIMAP is active.

Procedure

  1. Use the LOCATION attribute of the URIMAP resource to specify a URL of up to 255 characters, to which matching HTTP requests are redirected. The specification must be complete, 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.

    Optionally, you can use a fragment identifier (preceded by a # character) in the LOCATION attribute, to point a web browser to a reference or function in the item identified by the URL. For example, a fragment identifier can be the ID of a subsection in 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.

  2. Use the REDIRECTTYPE attribute of the URIMAP resource 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. 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.
    • 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).
  3. To cancel redirection, set the REDIRECTTYPE attribute to NONE. You do not need to change the URL specified in the LOCATION attribute, because it is used only when redirection is active.


dfhtl_inredirect.html | Timestamp icon Last updated: Sunday, 4 June 2017