Monday Oct 05, 2009

A Creative Way Of Using The Rewrite NameTrans SAF in WS7.0

When creating a reverse proxy mapping from a pattern like "/abc" to a file resource like "http://remoteserver/abc.jsp" on the remote server, the map function creates an undesirable effect of adding a slash "/", to the end of the URL that is being rewritten.  While this is per design,  and adding the slash "/" is intentional behavior of the reverse proxy functionality, this can be problematic when the mapping is to a file resource rather than to a file path.


The first problem with this is that the path gets rewritten to "http://remoteserver/abc.jsp/", causing a "404 Not Found" response from the remote server.  Another problematic effect of this is if the request to "/abc" was for a POST request.  When the request is for a POST to "/abc", the path gets rewritten to "http://remoteserver/abc.jsp/" via a "302 Redirect" response from the map function, resulting in the POST entity body being dropped from the request.


Web Server 7.0 is highly configurable and contains configurable features that can help remedy a problem like this in our reverse proxy functionality.  Here is a quick and easy way to do it - add the following configuration to the default object in the obj.conf before your general map NameTrans line to your reverse-proxy object :



<If uri="/abc">
NameTrans fn="rewrite" path="/abc/"
NameTrans fn="map" from="/abc" to="http://remoteserver/abc.jsp"
<If defined $vars{'escaped'} and $vars{'escaped'} =~'(.\*)/$'>
Route fn="set-variable" $vars{'escaped'}="$1"
</If>
</If>

By utilizing the above configuration, the rewrite NameTrans SAF will append a slash "/" to the end of the request path so to avoid the undesired behavior of the map NameTrans SAF.  The usage of the set-variable Route SAF is to remove the slash "/" for the escaped variable.


Documentation for the rewrite SAF.


Tuesday Sep 29, 2009

WS7.0 Admin Server Does Not Detect server is up and running

In support, we often times run into a problem that is reported by multiple customers.  Here is one problem that is generating a lot of support calls this last few months.


Bug CR 6801628 - \*Synopsis\* Adminserver doesn't detect the server is up and running.

Problem

The problem affects Sun Web Server 7.0 admin servers on T5240 machines.  When trying to start the web server via the admin gui or CLI, you may see the following error:


ADMIN3584: Error while starting the server. Please check the server logs.
However, when you do a "ps -ef" and make a request to your server instance, you will see that the server actually started.

Workaround

Two possible workarounds exist,
1. On Solaris 10, one can enable the extended FILE facility,


  •       stop the admin server

  •       add the following to the admin-server/bin/startserv:

  •           ulimit -n 65536
              LD_PRELOAD_32=/usr/lib/extendedFILE.so.1
              export LD_PRELOAD

  •       start the admin server

2.  For the admin server configuration, tune keep-alive's max-connections value < 100 in server.xml. For example, in your server.xml,

 <keep-alive><max-connections>64</max-connections></keep-alive>
Resolution

This bug is targeted to be fixed in WS7.0u7 which is due out sometime in November.



About

Quick tips and tricks, problems and resolutions, questions and answer, to help you with your Sun Java System Web Server.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today