Dynamic Web Development with Seaside

23.3.8Using AJP

AJPv13 is a binary protocol between Apache and Seaside. It was originally developed for Java Tomcat but there is nothing Java specific about it. Compared to conventional HTTP it has less overhead and better support for SSL.

Starting with version Apache 2.2 the required module mod_proxy_ajp is included with the default setup making it much simpler to use. The configuration looks almost the same as the one we saw in Section 23.3.5. The only difference is that you need to replace proxy_http with proxy_ajp, and that the protocol in the URL of the rewrite rule is ajp instead of http.

The adapted configuration looks like this:

<VirtualHost *>

    # set server name
    ProxyPreserveHost On
    ServerName www.appname.com

    # rewrite incoming requests
    RewriteEngine On
    RewriteRule ^/(.*)$ ajp://localhost:8003/appname/$1 [proxy,last]

</VirtualHost>

On the Smalltalk side you need to load the packages AJP-Core and AJP-Pharo-Core directly with Monticello from http://www.squeaksource.com/ajp. More conveniently you can also use the following Metacello script:

Gofer new
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfAjp';
load.
(Smalltalk globals at: #ConfigurationOfAjp)
project latestVersion load: 'AJP-Core'

At that point you need to add and start the AJPPharoAdaptor on the correct port from within your image (8003 in this example) and your web application is up and running with AJP.

Copyright © 19 March 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.