Content Aware Server Responses
WebSEAL supports the ability to use different response template pages for different content types. It also provides the ability to specify custom HTTP response codes for different generated responses. The content type and response code for a template file is determined by the name of the file itself. The MIME sub-type is defined by the file extension and the custom response code (if required) is embedded within the file name. The format of the file name is as follows:
<file identifier>{.<response_code>}.<mime sub-type>The following table includes example file names:
Filename Description login.html This file is returned for requests with the 'HTML' MIME sub-type. For example, text/html. The default login response code is used. login.json This file is returned for requests with the ‘json’ MIME sub-type. For example, application/json. The default login response code is used. login.401.json This file is returned for requests with the ‘json’ MIME sub-type. For example, application/json. The 401 HTTP response code is returned. WebSEAL determines the correct file to use when generating a response by one of the following scenarios:
- Locating the MIME sub-type in the ‘accept’ HTTP header of the request. It uses the first MIME entry that is found in the ‘accept’ header disregarding any specified quality factor and any subsequent MIME types;
- If the ‘accept’ HTTP header is not present it locates the MIME sub-type from the ‘content-type’ HTTP header in the request;
- If both headers are missing from the request it uses the content-type as defined by the ‘default-response-type’ configuration entry within the [acnt-mgt] stanza of the configuration file. See [acnt-mgt] stanza.
Once the correct content type is determined, WebSEAL searches for a matching file in the appropriate directory, as determined by the locale and junction. See Junction-specific static server response pages. If no matching file for the requested response type is located the appropriate directories are then searched for a file matching the default content type, as defined by the ‘default-response-type’ configuration entry.
By default WebSEAL sends a 302 response when a redirect is required, along with the 38cf0421.html error page. This error page can be customized with different response codes for different response types if a 302 response is not desired.
WebSEAL provides two out-of-the-box (OOTB) JSON response files: management/C/default.json and errors/C/default.500.json. To revert to the legacy WebSEAL behaviour of returning HTML files for all responses, delete these two response files from the management root of your WebSEAL instance.
Parent topic: Web server response configuration
Related concepts
- Static server response pages
- Server response page locations
- HTML server response page modification
- Account management page configuration
- Error message page configuration
- Add custom headers to server response pages
- Local response redirection
- HTML redirection
Related tasks
- Handling the favicon.ico file with Mozilla Firefox
- Configure the location URL format in redirect responses
Related reference