0

Im using mod_proxy_ajp to redirect from Apache to Tomcat. Apache is runnig on port 80 and tomcat ajp connector set on port 8081. here is my virtual host configuration:

<virtualHost *:80> ServerName www.example.com ProxyRequests Off ProxyPreserveHost On <Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> ProxyPass / ajp://localhost:8081/example/ ProxyPassReverse / ajp://localhost:8081/example/ <Location /> Order allow,deny Allow from all </Location> </VirtualHost> 

The problem is when i type url www.example.com ( example is in tomcat webapp directory) only the title of example app loads and the browser stop loading and nothing happens. any idea? Thanks and sorry for my poor english

1 Answer 1

0

In the default configuration, the 8080 port serves HTTP content, and AJP is served using the 8009 port. You can confirm this in tomcat's server.xml file, an example:

<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector executor="tomcatThreadPool" port="8009" protocol="AJP/1.3" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" /> 

mod_proxy_ajp does not require a ProxyPassReverse directive, so you can simply replace:

ProxyPass / ajp://localhost:8081/example/ ProxyPassReverse / ajp://localhost:8081/example/ 

with:

ProxyPassMatch ^/(example)(.*) ajp://localhost:8009/$1$2 ttl=120 ping=1 

in the Apache configuration. Use the appropriate port for AJP.

6
  • Tnx Man! Its worked! Commented Jul 13, 2013 at 21:28
  • Sorry man but now i have another problem... how can i remove (example) from ProxyPassMath? because in this way i should type url like www.example.com/example ! but i just want to use www.example.com Commented Jul 13, 2013 at 23:07
  • I did that but the problem came back again! the browser just load the title and then nothing happens! Commented Jul 14, 2013 at 9:44
  • the problem is still here...just title loads :( Commented Jul 14, 2013 at 11:10
  • I don't really know what does it mean that "only title loads". I have shown several different ways to proxy traffic through apache to tomcat. Commented Jul 14, 2013 at 11:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.