*.do
.
Note that the RewriteRule directives are kept as simple as possible, but in practice can contain regular expressions and backreferences to alter an entire class of URIs.
*.do
, so we need to alter the URI to include so the plug-in will recognize and handle the request.
WebSphere Resource | Link in HTML |
---|---|
/servlet/members/ProjectA/V3/SignIn.do | /ProjectA/SignIn |
The link as written won't be recognized by the WebSphere plug-in, and consequently has no hope of getting passed to WebSphere Application Server, so we add the following configuration:
RewriteEngine on
RewriteRule /ProjectA/SignIn /servlet/members/ProjectA/V3/SignIn.do [PT]
The PT flag is required, as this is what lets the WebSphere plug-in observe the results of the mod_rewrite processing.
The Alias directive isn't effective here, because that only maps a URI to a filename on the IHS system and doesn't change the URI in the request. If it was used, IHS would be trying to find /servlet/members/ProjectA/V3/SignIn.do under the Document Root.
*.do
pattern, but should be served as a static file. Because it's a URI already known to the outside world, he has to make some provision to ensure it's not passed to WebSphere.
Filesystem Resource | Link in HTML |
---|---|
htdocs/scooby_do.jpg | /scooby.do |
This link as written will be recognized by the WebSphere plug-in and passed to WebSphere Application Server, so we add the following directives to the IHS configuration to make sure it's served out of the filesystem:
RewriteEngine on
RewriteRule /scooby.do scooby_do.jpg [PT]
The PT flag is required, as this is what lets the WebSphere plug-in observe the results of the mod_rewrite processing.
The Alias directive is not effective here, because that only maps a URI to a filename on the IHS system and doesn't change the URI in the request.
During request processing, the plug-in will have no interest in the new URI of scooby_do.jpg.
The Redirect directive would be effective here, which is somewhat slower but updates the users browser with the proper URI
Redirect /scooby.do /scooby_do.jpg
WebSphere Resource | Typo |
---|---|
/servlet/already.do | /servlet/allready.do |
We change the URI that will be seen by the WebSphere plug-in as follows:
RewriteEngine on
RewriteRule /servlet/allready.do /servlet/already.do [PT]
The PT flag is required, as this is what lets the WebSphere plug-in observe the results of the mod_rewrite processing.
The Alias directive is not effective here, because that only maps a URI to a filename on the IHS system and doesn't change the URI in the request. This would cause the WebSphere plug-in to handle the request but still operate on the original URI.
The Redirect directive would be effective here, which is somewhat slower but updates the users browser with the proper URI
Redirect /servlet/allready.do /servlet/already.do
One motivation for this aside from freeing up WebSphere threads is that only URLs served out of the IHS filesystem can be protected with .htaccess files, WebSphere resources must be preotected with <Location> containers explicitly in httpd.conf.
The WAR file has been pushed to the IHS server in the /tmp directory.
The original access log entry which shows the plug-in handling the response: 127.0.0.1 - (mod_was_ap20_http.c/-2/handler) - [01/Dec/2006:14:57:51 -0500] "GET /SillyNew/theme/blue.css HTTP/1.1" 200 9049 After enabling config change as illustrated above, IHS has attempted to serve the file from its own filesystem: 127.0.0.1 - (mod_auth.c/401/check_user_id) - [01/Dec/2006:15:10:13 -0500] "GET /SillyNew/theme/blue.css HTTP/1.0" 401 466 After enabling above and sending the proper userid/password 127.0.0.1 - (core.c/0/handler) user1 [01/Dec/2006:15:11:15 -0500] "GET /SillyNew/theme/blue.css HTTP/1.0" 200 9049
RequestHeader
directive to change the Host headerRequestHeader
directive cannot effectively be used to influence the plug-in while it's deciding whether or not to handle the request, because the plug-in has completed this processing before RequestHeader
takes effect.
In the case that a request is going to be routed to the plug-in initially, RequestHeader
can be used to change the Host: header passed on by the plug-in to the Application Server.
There may be some configurations which exploit this behavior to serve things such as images out of the filesystem instead of from WebSphere using an Alias directive -- upgraders will find they must replace this Alias directive with an equivalent RewriteRule directive.
Incorrect: Alias /servlet/images/ /images/
Correct : RewriteRule /servlet/images/(.*) /images/$1 [PT]