Running Apache and Tomcat on guest VM, Tomcat redirects to host -
i'm trying deploy webapp on vagrant vm , having issues tomcat redirects , ports.
here's configuration:
guest os cent os 6.3 running on virtualbox.
apache 2.4 installed , running on guest host port 4000 being forwarded guest port 80.
tomcat 7 installed , running on guest host port 4040 being forwarded guest port 8000 (for jpda debugger).
mod_jk installed forward requests apache tomcat.
for part, works. have 1 webapp deployed @ /mywebapp, can access entering http://localhost:4000/mywebapp host browser. problem occurs when mywebapp application credentials check, , issues redirect if there no logged in user.
what happens @ point host browser url changed https://localhost/mywebapp/login.jsp instead of https://localhost:4000/mywebapp/login.jsp, causes me error since don't have apache running on host machine.
i know mod_jk working, because can debug mywebapp application , follow point forward happens, know request being forwarded to tomcat. because of believe problem lies tomcat , not apache.
here server.xml file
<?xml version="1.0" encoding="utf-8"?> <server port="8005" shutdown="shutdown"> <listener classname="org.apache.catalina.startup.versionloggerlistener"/> <listener sslengine="on" classname="org.apache.catalina.core.aprlifecyclelistener"/> <listener classname="org.apache.catalina.core.jasperlistener"/> <listener classname="org.apache.catalina.core.jrememoryleakpreventionlistener"/> <listener classname="org.apache.catalina.mbeans.globalresourceslifecyclelistener"/> <listener classname="org.apache.catalina.core.threadlocalleakpreventionlistener"/> <globalnamingresources> <resource auth="container" description="user database can updated , saved" factory="org.apache.catalina.users.memoryuserdatabasefactory" name="userdatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.userdatabase"/> </globalnamingresources> <service name="catalina"> <connector connectiontimeout="20000" port="8080" protocol="http/1.1" redirectport="8443" /> <!-- define ajp 1.3 connector on port 8009 --> <connector port="8009" protocol="ajp/1.3" redirectport="8443"/> <engine defaulthost="localhost" name="catalina"> <realm classname="org.apache.catalina.realm.lockoutrealm"> <realm classname="org.apache.catalina.realm.userdatabaserealm" resourcename="userdatabase"/> </realm> <host appbase="webapps" autodeploy="true" name="localhost" unpackwars="true"> <valve classname="org.apache.catalina.valves.accesslogvalve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/> </host> </engine> </service> </server>
if there other config files need share please let me know.
if ssh guest vm manually , run
wget localhost/mywebapp
it returns page expected. i'm not sure means.
https , http run on different ports (443 , 80 respectively, default), https://localhost:4000 doesn't make sense, since http using port.
you need either:
- forward https port (probably, messy because forwarding ports under 1000 can done privileged users); or
- instead of using port forwarding, configure vm private network , use assigned ip address, rather
localhost
currently.
option 2 recommendation.
Comments
Post a Comment