How to mask a tomcat app behind an apache subdomain? -


i have 2 separate servers: apache public server , internal tomcat one. our users able use our tomcat apps without exposing details of our implementation (actual port, server name, context) through public apache server this:

http://credits.publicdomain.com/servlet

instead of

http://tomcat.internaldomain.com:8082/creditsapp/servlet

how can configure apache server mask requests our tomcat apps way? using apache modules such mod_rewrite or mod_proxy straightforward approach?

i have tried configuration virtualhost in apache, works first servlet. seems disable tomcat keep session first servlet other servlet go afterwards:

servername credits.publicdomain.com

proxyrequests off proxypreservehost on  <proxy *>     order deny,allow     allow </proxy>                          proxypass        / http://tomcat.internaldomain.com:8082/creditsapp/ proxypassreverse / http://tomcat.internaldomain.com:8082/creditsapp/ 

am missing additional configuration in tomcat server in order work without context between servlets?

mod_jk need bridge tomcat apache, can focus on app , apache, front-end, can deal https , authentication , such. forward urls 'workers' in tomcat. need tell apache load mod_jk, need configure worker.properties, apache need know worker what, , need define service in tomcat.

these directives in httpd.conf configure mod_jk:

jkworkersfile conf/workers.properties
jklogfile /var/log/tomcat/mod_jk.log jkloglevel info

the jkworkersfile in /etc/httpd/conf/workers.properties defines sockets

 workers.tomcat_home=/var/tomcat4  workers.java_home=/usr/java/jdk  ps=/  worker.list=worker1,worker2  worker.worker1.port=8009  worker.worker1.host=localhost  worker.worker1.type=ajp13  worker.worker2.port=8010  worker.worker2.host=localhost  worker.worker2.type=ajp13 

this snippet httpd.conf delegate (i.e. /* ) worker1:

<virtualhost 192.0.34.72>       serveradmin webmaster@ example.com       documentroot /www/www.example.com/webapps/root       servername www.example.com       errorlog logs/public_errors       loglevel debug       customlog logs/public_access combined       jkmount /* worker1       <directory "/www/www. example.com/webapps/root">           options indexes followsymlinks indexes           allowoverride none           order allow,deny           allow      </directory>       <location "/web-inf/">           allowoverride none           deny       </location>       <location "/meta-inf/">           allowoverride none           deny       </location> </virtualhost> 

and tomcat have service:

<service name="public">     <connector classname="org.apache.coyote.tomcat4.coyoteconnector" port="8009" minprocessors="5" maxprocessors="75" enablelookups="true" redirectport="8443" acceptcount="10" debug="0" connectiontimeout="0" useurivalidationhack="false" protocolhandlerclassname="org.apache.jk.server.jkcoyotehandler" />      <engine name="standalone" defaulthost="localhost" debug="0">         <logger classname="org.apache.catalina.logger.filelogger" prefix="catalina_log." suffix=".txt" timestamp="true" /> <realm classname="org.apache.catalina.realm.userdatabaserealm" debug="0" resourcename="userdatabase" />           <host name="localhost" debug="0" appbase="/www/www.example.com/webapps" unpackwars="true" autodeploy="true">             <logger classname="org.apache.catalina.logger.filelogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true" />          </host>     </engine> </service> 

the above examples notes, check update documentation at: http://tomcat.apache.org/connectors-doc/generic_howto/workers.html http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -