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:
- Locate the URIMAP definition for the URL that you want to redirect.
- 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.
Optional: 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.
- 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.
- 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.
- 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.