Thursday, May 6, 2010

Getting Mod_Proxy to bounce to Tomcat (FINALLY)

This particular problem has been plaguing me for months.  How to make HTTPD proxy to a Tomcat instance.  Finally got it figured out.  BONUS:  Also configured it to authenticate via MySQL before proxying the connection.  This is using a self-signed SSL cert.

< VirtualHost >

        SSLEngine On
        SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
        SSLCertificateFile      /etc/apache2/ssl/server.crt
        SSLCertificateKeyFile   /etc/apache2/ssl/server.key

ProxyRequests Off
ProxyPreserveHost On

< Proxy * >
        Order deny,allow
        Allow from all
< /Proxy >

        ProxyPass /
        ProxyPassReverse /

< Location >
AuthName                        "Level 4 Staff Tools Login"
AuthType                        Basic
AuthUserFile                    /dev/null
AuthBasicAuthoritative          Off

Auth_MySQL                      On
Auth_MySQL_Password_Table       users
Auth_Mysql_Group_Table          staffGroups

Auth_MySQL_Username_Field       userName
Auth_MySQL_Password_Field       password
Auth_MySQL_Group_Field          groups
Auth_MySQL_Empty_Passwords      Off
Auth_MySQL_Encryption_Types     Plaintext Crypt_DES MySQL

require                         group engineering art

#        Order allow,deny
#        Allow from all
< /Location >

        ErrorLog /var/log/apache2/error.log

No comments:

Post a Comment