This article describes how to configure Apache HTTP server to proxy HTTP traffic to the MailArchiva web console. This method requires both AJP and Web Sockets communications. The following modules are required: mod_jk, mod_proxy and mod_proxy_wstunnel. Since Web Socket support was only added to Apache from v2.4.5 onwards, it is necessary to install/upgrade to Apache v2.4.5 or higher. An easier, alternative integration method is also available.
The mod_proxy and mod_proxy_wstunnel are included as part of the base Apache distribution. It may be necessary to download, compile and install the Apache mod_jk Tomcat Connector. See https://tomcat.apache.org/download-connectors.cgi for the download link.
To load the required modules, add the following to Apache's /etc/apache2/httpd.conf main configuration file:
At the bottom of the file:
The jk.conf file is created when the jk_module is compiled and installed. It references a /etc/apache2/worker.properties file. Edit the file as follows:
The mod_proxy proxy.conf (referenced by httpd.conf) file should contain the following:
Ensure the Tomcat embedded with MailArchiva has both an AJP and an HTTP connector enabled.
Add a new virtual host configuration and enable as follows:
The virtual site configuration should contain:
<VirtualHost *:80>
ServerName site.com
ServerAlias www.site.com
JkUnMount /ws2 worker1
JkUnMount /wss2 worker1
SSLProxyEngine On
ProxyPreserveHost On
#ProxyRequests Off
ProxyPass /wss/ wss://localhost:8090/linkage
ProxyPass /ws/ ws://localhost:8090/linkage
ProxyPassReverse /ws/ ws://localhost:8090/linkage
ProxyPassReverse /wss/ wss://localhost:8090/linkage
</VirtualHost>
In /opt/mailarchiva/server/conf/server.xml, uncomment the following line (as necessary):
Restart MailArchiva. MailArchiva should be accessible at http://localhost/site
Set proxy system variable to ensure that MailArchiva has visibility to the user's IP address.
Linux: Add -Dproxy=yes variable to CATALINA_OPTS in /opt/mailarchiva/server/startserver script
Windows: Right click tray icon, click Configure, select Java tab, In Java Options add -Dproxy=yes