Using apache2 I wish to setup an AJP proxy for any Tomcat server that maps an interior servlet Hyperlink to a totally different URL externally. Presently I'm while using following designs:

Apache2 configuration:

<IfModule mod_proxy.c>
    ProxyPreserveHost on
    ProxyPass /external_name ajp://192.168.1.30:8009/servlet_name
    ProxyPassReverse /external_name ajp://192.168.1.30:8009/servlet_name
</IfModule>

Observe that external_name and servlet_name will vary.

Tomcat 6 configuration:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Nevertheless this doesn't work. Apache appears to forward http demands to Tomcat. Nevertheless the Web addresses and redirects came back by Tomcat continue to be while using original servlet_name and Apache doesn't map these to external_name.

Is possible whatsoever with AJP? Otherwise will it be achieved utilizing a plain http proxy rather?

Mapping different names between Apache and Tomcat can be very tricky and is dependent much how the net application develops its web addresses for that response.

Essentially your setup is correct, but when the application uses its very own servlet_reputation for redirects and web addresses ProxyPassReverse will not map them.

If you want this type of setup take a look at mod_proxy_html (Apache third party module) that will parse and rewrite even the contents, not just the url and response headers as mod_proxy.

( A late answer, however i just went into this issue myself. )

It seems that ProxyPassReverse using ajp: does not work since the headers came back from the redirect do not have an ajp: URL in Location:, there is a http: URL. ProxyPassReverse just leads to a rewrite of matching headers, and that string does not match what's being came back.

This will work (provided the place: area uses that statistical address and never a number title.)

ProxyPreserveHost on
ProxyPass /external_name ajp://192.168.1.30:8009/servlet_name
ProxyPassReverse /external_name http://192.168.1.30/servlet_name

( You should use 'curl -I' to examine the redirect headers and debug. )

See this note, or a far more involved solution here using mod_proxy_html for spinning the Web addresses in webpages too.