Apache in front of Domino - 08/30/2004

What

This is a configuration example of how to configure Apache and Domino to work together. On one computer with one IP address, and all the users see run from port 80.

Why

There are a number of situations, where you would want to run several web application servers on the same IP address, all on port 80.
  • If you only have one public IP address.
  • You want to run in a mixed environment, like Domino, Ruby on Rails, JSP, PHP, ASP and other server side code.
  • An SSL certificate is for a specific host name.
You may also want to take advantage of some of Apache's advanced configuration features.

How

Configure Domino to listen on port 81

Edit the server document in the Domino directory:

Change the field labeled "TCP/IP port number" to 81, or any other available port you like.

Configure Apache's rewrite module

In httpd.conf we find most of the Apache's configuration.

First we need to load some modules:
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so


Allow access to Domino's icon and java directories:
<Directory "/local/notesdata/domino/icons">
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/local/notesdata/domino/java">
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Alias /icons/ "/local/notesdata/domino/icons/"
Alias /domjava/ "/local/notesdata/domino/java/"
Remember to remove the alias to Apache's icons or create an icons alias inside a virtual host.

Then we need to configure a virtual host:
<VirtualHost 192.168.1.3>
    DocumentRoot /somedir/bofrede.com
    ServerName www.bofrede.com
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule ^/$ http://%{SERVER_NAME}:81/bofrede/en.nsf [P]
        RewriteRule ^/en/(.*)$ http://%{SERVER_NAME}:81/bofrede/en.nsf/$1 [P]
        RewriteRule ^/(.+)\.nsf(.*)$ http://%{SERVER_NAME}:81/$1.nsf$2 [P]
        RewriteRule ^/\$Preferences.nsf(.*)$ http://%{SERVER_NAME}:81/\$Preferences.nsf$1 [P]
        RewriteRule ^/servlet/(.+)$ http://%{SERVER_NAME}:81/servlet/$1 [P]
        RewriteRule ^/diiop_ior.txt$ http://%{SERVER_NAME}:81/diiop_ior.txt [P]
        RewriteRule ^/dwagss.jar$ http://%{SERVER_NAME}:81/dwagss.jar [P]
        RewriteRule ^/dwa8W.cab$ http://%{SERVER_NAME}:81/dwa8W.cab [P]
        RewriteRule ^/robots.txt$ http://%{SERVER_NAME}:81/bofrede/en.nsf/robots.txt [P]
        RewriteRule ^(.*)/favicon.ico$ http://%{SERVER_NAME}:81/bofrede/en.nsf/favicon.ico [P]
        ProxyPassReverse / http://www.bofrede.com:81/
    </IfModule>
</VirtualHost>
The "big discovery" here is the ProxyPassReverse directive, that fixes the url's in Domino's http response header. This is what makes redirects work. Redirects occur i.e. at form submission, when the url in $$Return is sent to the browser. Without ProxyPassReverse the browser would be redirected to some url at port 81.
Last updated: 05/20/2008
BoFrede™ Craft: Website development.