This tip is about making IIS as a front end to Tomcat hosting Servlets and JSPs on the back end. This architecture allows the hosting of JAX-WS or Restlet services in Tomcat while Silverlight clients are hosted in IIS without facing cross-domain issues.

The configuration files and the connector (isapi_redirect.dll) are available as an attachment to this post. Before continuing, you must download the Zip archive and unzip it to C:\Program Files\Apache Software Foundation

The following is inspired from

The Apache Tomcat Connector - Webserver HowTo : IIS HowTo

Pre-requisites

From this point, we assume that

  • IIS 5.1 is installed on a Windows XP SP2 Professional Edition
  • Apache Tomcat 6.0.16 is installed and working properly on the same OS
    • The Tomcat installation directory is C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.16
  • You have unzipped the archive, you must have the following directory : C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector

Configuring the ISAPI Redirector

  • Open the Registry Editor, Run—>regedit

Create a new registry key names “HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\1.0

  • The following screenshot shows you the different values you have to create in the previous created key

image 

name value
extension_uri /jakarta/isapi_redirect.dll
log_file C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\log\isapi_redirect.log
log_level info
worker_file C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\conf\workers.properties.minimal
worker_mount_file C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\conf\uriworkermap.properties
  • Open the IIS Management Console
  • add a new Virtual Directory to the Default Web Site

image

  • Alias must be set to “jakarta
  • Directory must be set to isapi_redirector.dll location C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\bin
  • Allow Execute permission
    image

Now let’s add a new ISAPI filter

  • open the properties dialog of the Default Web Site, in the ISAPI Filters tab, click add to add a new filter.
  • Set the filter name to “jakarta”
  • Executable is the exact location of the isapi_redirect.dll : C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\bin\isapi_redirect.dll
  • Restart the IIS Server then check for the jakarta filter, an up-green arrow has appeared

 image

Also start Tomcat server.

In a Web Browser, ensure that http://localhost:8080/examples/jsp/index.html is accessible :

image

It’s normal, this page is served by Tomcat (assuming that it is running on port 8080)

Now access to this page within IIS (in our case, we set IIS port to 81), by default port 80 is used.

image

Go to http://localhost:81/examples/jsp/index.html. A similar page is displayed.

Try to execute a jsp example :

image

image

Configuring the URL mapping

In the C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\conf directory you will find two configuration files :

In the uriworkermap.properties you will find the mapping of URL to be handled by the workers declared in workers.properties. An example of URL mapping:

default.worker=ajp13

/docs=$(default.worker)
/docs/*=$(default.worker)
/examples=$(default.worker)
/examples/*=$(default.worker)
/host-manager=$(default.worker)
/host-manager/*=$(default.worker)
/manager=$(default.worker)
/manager/*=$(default.worker)

In this configuration, every request on /examples/* will be handled by the Tomcat process, that’s how we managed to serve JSPs and Servlets from IIS through Tomcat. You may add your own URL patterns... if you do so, don’t forget to restart the Tomcat Server.

- Ronny Kwon