Request mapping

This topic provides an overview of how the proxy server matches an HTTP request that is received to an application that is deployed in the cell or routing rule.

Unlike the Apache Web server or Caching Proxy, which have flat configuration files with routing precedence that is inherent to the ordering of directives, the proxy server uses a best match mechanism to determine the installed application or routing rule that corresponds to a request. The virtual host or URI patterns determine the best match for a Web module or routing rule. For applications that are deployed in clusters, the proxy server maintains affinity (Secure Sockets Layer ID, cookie, and URL rewriting), otherwise, a weighted round-robin approach is used to select the target server. The following examples address various routing scenarios for when routing rules and applications are deployed within the same cell.

Proxy environment. A WAS proxy called proxy1 is active in the same cell as the applications and routing rules. All of the applications and routing rules are enabled in the cell for proxy1, and PROXY_HTTP_ADDRESS for proxy1 is set to 80.

Virtual host Host name Port
default_host host1.company.com 80
  host1.company.com 9080
  * 80
proxy_host host2.company.com 80
  * 443
  * 80
server_host host3.company.com 80

URI group name URI patterns
ALL /*
ROOMS /kitchen/*, /bathroom/*, /bedroom/*
CONFLICT /WM2C/*

Generic server cluster name Protocol Host Port
CLUSTER1 HTTP webserver1.company.com 9081
    webserver2.company.com 9083
CLUSTER2 HTTP host47.company.com 8088
    host48.company.com 8088
CLUSTER2-SSL HTTPS host47.company.com 8443
    host48.company.com 8443

Routing rule name Virtual host URI group Action
ALLTOCLUSTER1 proxy_host ALL Generic server cluster - CLUSTER1
ROOMTOCLUSTER2 proxy_host ROOMS Generic server cluster - CLUSTER2
ALLTOCLUSTER2 server_host ALL Generic server cluster - CLUSTER2
REDIRECTTOCONFLICT default_host CONFLICT Redirect - http://www.conflict.com

Application name Context root Web module name Virtual host Web module URI patterns
App1 /WM1A/ Web Mod A default_host wm1a.jsp
  /WM1B/ Web Mod B default_host wm1b.jsp
App2 /WM2C/ Web Mod C default_host /*, wm2c.jsp
  /WM2D/ Web Mod D default_host /*, wm2d.jsp

Example 1: Basic request. The proxy1 proxy receives the following request:

GET /WM1A/wm1a.jsp HTTP/1.1 
Host: host1.company.com
Result. The wm1a.jsp file is sent as the response. The ALLTOCLUSTER1 routing rule is a possible match, but Web Mod A is chosen as the best match by proxy1 because the combination of its context root and URI pattern /WM1A/wm1a.jsp is a better match than /*. Web Mod A is also chosen as the best match because its virtual host contains the host1.company.com:80 alias, which is a more specific match than the *:80 wild card alias.

Example 2: Routing rules that use the same URI group and different virtual hosts . The proxy1 proxy receives the following request:

GET /index.html HTTP/1.1 
Host: host3.company.com
Result. The proxy1 proxy maps the request to the ALLTOCLUSTER2 routing rule, and a response is received from a server in CLUSTER2. The ALLTOCLUSTER1 routing rule is a possible match and can handle the request if the ALLTOCLUSTER2 routing rule did not exist. However, the ALLTOCLUSTER2 rule is the best match because its virtual host (server_host) explicitly lists host3.company.com.

Example 3: Routing rules that use same virtual host and different URI groups. The proxy1 proxy receives the following request:

GET /kitchen/sink.gif HTTP/1.1 
Host: host2.company.com
Result. The proxy1 proxy maps the request to the ROOMSTOCLUSTER2 routing rule and a server from the CLUSTER2 cluster sends a response. The ALLTOCLUSTER1 routing rule is a possible match, but the ROOMSTOCLUSTER2 rule is the best match because its URI group contains a pattern /kitchen/* that is a better match for the request URI /kitchen/sink.gif.

Example 4: Routing rule URI group conflicts with URI pattern of a Web module that uses the same virtual host. The proxy1 proxy receives the following request:

GET /WM2C/index.html HTTP/1.1 
Host: host1.company.com
Result. Indeterminate. It is unknown whether Web Mod C or the REDIRECTTOCONFLICT routing rule handles the request because they use the same virtual host and have the same URI pattern. In such cases, the ID DWCT0007E message is displayed in SystemOut.log file for the proxy1 proxy. In this example, changing the REDIRECTTOCONFLICT routing rule to use a different virtual host resolves the problem.

Example 5: The PROXY_HTTP_ADDRESS address is not in the virtual host. Assume that the proxy1 proxy address, PROXY_HTTP_ADDRESS, is changed to 81, while all of the other configuration information remains the same. The proxy1 proxy receives the following request:

GET /index.html HTTP/1.1 
Host: host1.company.com:81
Result. The proxy1 proxy is unable to handle the request because the PROXY_HTTP_ADDRESS address is not available in a virtual host and will send an HTTP 404 response back to the client.