Last year I began to integrate Google Checkout into a project, and I needed my development server to respond to a “real” https request. I was developing with tomcat in eclipse, and I already had a production machine (co-located elsewhere) already running apache with SSL fully configured with a proper certificate for its domain, etc. I also had a VPN connection to that production machine from my internal network.
My solution was to setup a mod_jk connection from apache directly to my development machine. I configured it so all incoming traffic with url “/b/*” would be directed to my development machine, and served back out through the public server, via https, etc.
Here’s what I did:
1) I added the mod_jk module in my httpd.conf. (Note that you may need to compile a mod_jk.so file, which is beyond the scope of this post.)
|LoadModule jk_module libexec/apache22/mod_jk.so|
2) I added configs for mod_jk in httpd.conf:
# Where to find workers.properties
# Where to put jk shared memory
# Where to put jk logs
# Set the jk log level [debug/error/info]
# Select the timestamp log format
## my mod_jk mounts, same for SSL section too
3) I created the worker.properties file:
# Define workers using ajp13
# Set properties for worker1 (ajp13)
# Set properties for worker2 (ajp13)
4) I created the mod_jk_mounts.conf file:
# the /a path is for the local prod tomcat
# the /b path is dev, points to 10.1.0.67
5) I restarted my apache server. I loaded My website with a URL like “http://mysite.domain/b/quux” instead of “http://mysite.domain/a/quux”. Or I’ve used the dev url for testing with Google Checkout, or Twilio.
A minor caveat: If you are using cookies, and you are setting a specific domain, be mindful that the http client is connecting to your public server, and you will only receive cookies that match the domain of your public server.
This has worked like a champ… …until I began using the Google Eclipse Plugin, which uses Jetty as a server rather than Tomcat. But how I solved that is the next story…