Apache Proxy for Filemaker 10 Advanced Server IWP

This isn’t any major ground breaking discover, not even a minor hack. What it is, however, is a simple solution to a question that didn’t  turn up any good results when I tried to Google it earlier on.

The Problem: I have a user with a Filemaker database that they want to quickly share via the Internet, which is generally easy to do using the Instant Web Publishing (IWP). I don’t, however, want to have the Filemaker server exposed through the firewall. I want to be able to use an Apache server I have sitting on the edge of the network to proxy for it instead.

The (old) Solution: With the old Filemaker Server 7 we were able to using the basic Apache mod_proxy using the ProxyPass and ProxyPassReverse directives worked fine. There was a trick though, and that was that you had to proxy back to a specific port on the Filemaker server, port 16080, otherwise your request for http://external.server/fmi/iwp/ would keep redirecting to http://internal.server/fmi/iwp/. So in short our Apache conf would work with:
ProxyPass /fmi/iwp http://internal.server:16080/fmi/iwp
ProxyPassReverse /fmi/iwp http://internal.server:16080/fmi/iwp

Unfortunately this approach no longer worked when we installed a new Filemaker 10 Advanced Server system. The port 16080 solution no longer existed and the same problems with just doing a straight reverse proxy still existed.

The (new) Solution: So some simple digging in the Apache config on the Filemaker server showed that Filemaker is simply inserting their own version of mod_jk (they are calling it mod_jk_fm) into Apache and then talking back to their own Tomcat server they installed as part of the package. Right at the end of the httpd.conf they have:
Include '/Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/mod_jk.conf'

and said mod_jk.conf looks like:
LoadModule jk_fm_module '/Library/FileMaker Server/Web Publishing/publishing-engine/web-server-support/apache-2.2/mod_jk_fm.so'
JkFmWorkersFile '/Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/workers.properties'
JkFmLogFile '/Library/FileMaker Server/Logs/web_server_module_log.txt'
JkFmShmFile '/Library/FileMaker Server/Logs/mod_jk_shm.txt'
JkFmLogLevel error
JkFmLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkFmOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkFmRequestLogFormat "%w %V %T"
JkFmMount /fmi/config config
JkFmMount /fmi/config/* config
JkFmMount /fmi/iwp wpc
JkFmMount /fmi/iwp/* wpc
JkFmMount /fmi/xml/* wpc
JkFmMount /fmi/xsl/cnt/* cwpe
JkFmMount /fmi/xsl/relay/* cwpe
JkFmMount /fmi/xsl/*.xsl cwpe

and the workers.properties file is just:
worker.list=wpc,cwpe,config
worker.config1.host=127.0.0.1
worker.config1.type=ajp13
worker.config1.port=16018
worker.config1.lbfactor=1
worker.config2.host=127.0.0.1
worker.config2.type=ajp13
worker.config2.port=16018
worker.config2.lbfactor=1
worker.cwpe1.host=127.0.0.1
worker.cwpe1.type=ajp13
worker.cwpe1.port=16018
worker.cwpe1.lbfactor=1
worker.cwpe2.host=127.0.0.1
worker.cwpe2.type=ajp13
worker.cwpe2.port=16018
worker.cwpe2.lbfactor=1
worker.wpc1.host=127.0.0.1
worker.wpc1.type=ajp13
worker.wpc1.port=16016
worker.wpc1.lbfactor=1
worker.wpc1.retries=20
worker.wpc2.host=127.0.0.1
worker.wpc2.type=ajp13
worker.wpc2.port=16016
worker.wpc2.lbfactor=1
worker.wpc2.retries=20
worker.config.type=lb
worker.config.balance_workers=config1,config2
worker.cwpe.type=lb
worker.cwpe.balance_workers=cwpe1,cwpe2
worker.wpc.type=lb
worker.wpc.balance_workers=wpc1,wpc2

As it turns out, the naive approach/solution is the one that works. FM 10 Server’s instance of Tomcat is listening on all of the network interfaces, not just the localhost, and will happily accept AJP13 connections from other systems. What I did on my external (proxying) Apache server was to install my own copy of mod_jk and then include my own modified version of the the mod_jk.conf into the man httpd.conf:

JkWorkersFile etc/apache2/workers.properties
JkLogFile /var/log/jk.log
JkShmFile /var/log/jk-runtime-status
JkLogLevel error

JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"


I trimmed down my own workers.properties (using the IP adress of the internal FM server for the host field) to:
worker.list=wpc
worker.wpc1.host=###.###.###.###
worker.wpc1.type=ajp13
worker.wpc1.port=16016
worker.wpc1.lbfactor=1
worker.wpc1.retries=20
worker.wpc2.host=###.###.###.###
worker.wpc2.type=ajp13
worker.wpc2.port=16016
worker.wpc2.lbfactor=1
worker.wpc2.retries=20
worker.wpc.type=lb
worker.wpc.balance_workers=wpc1,wpc2

and then in my VirtualHost definition for the proxying site I have:
###
# Filemaker 10 server Instant Web Publishing Proxy
###

JkMount /fmi/iwp wpc
JkMount /fmi/iwp/* wpc

That was it. I think I spent far more time trying to Google an answer to the initial problem than I did in actually solving it once I finally decided to take my own look at things. I am sure there is some sort of life lesson in there, but for the sake of those who don’t want to learn them themselves, I have provided you with my solution.

Tags: ,

Leave a Reply