Redirection support for HTTP tests

When you run HTTP tests, redirect requests are followed automatically, which supports common usage patterns, such as load balancing.

HTTP redirect responses are responses to requests with status codes in the 300 family, which indicate that the requested content is found at a different location. Redirect responses include HTTP status codes such as 301 Moved Permanently and 302 Found. Some HTTP applications redirect clients to a specific URL, but the ultimate response to the client request can be handled by one of several servers to balance the load that each server handles. For example, a request that is sent to http://www.example.com/ might be redirected to http://www-1.example.com or http://www-2.example.com, depending on traffic and load conditions.

Both expected redirect and unexpected redirect responses are supported when you run tests. Expected redirect responses occur when you record tests. Unexpected redirect responses are received from the server when you run tests, but the responses are not present in the recorded test.

Expected redirect responses are handled by automatic data correlation. To automatically correlate host names and port numbers, click Window > Preferences > Test > Test Generation > HTTP Test Generation > Data Correlation, and then select the Automatically correlate URL pathname if redirected by response check box. This option is selected by default.

Unexpected redirect requests are followed until an HTTP status code that is not a redirect response, such as 200 OK, is returned by the server, or until the maximum number of redirect responses has been reached. By default, the maximum number of redirect responses to follow is 10. When a 200 OK response is received, references that use the data in the final response are created.

Server access configurations are updated dynamically for unexpected redirect responses. For example, for a Config_1 server access configuration, where the host is abc.example.com and the port is 80, if a request that uses that configuration is redirected to port 8080 on the xyz.example.com host, all subsequent requests in the test that use the same configuration use port 8080 on the xyz.example.com host.

Verification points in a request are applied to the final destination. You can set a ResponseCode verification point in a request so that an unexpected redirection can be handled appropriately. If you set an exact ResponseCode verification point, it fails when a redirection occurs. A relaxed verification point also fails if the status codes in the 300 family are not part of the relaxed code list.