Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7897409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:09:33+00:00 2026-06-03T08:09:33+00:00

I am connecting to two tomcat application via the ajp protocol. both of which

  • 0

I am connecting to two tomcat application via the ajp protocol.
both of which are running in separate tomcat virtual host as ROOT.war.
On the server, I have configured the /etc/hosts file

127.0.0.1       localhost  tcvh1 tcvh2

apache httpd.conf:

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
        #ProxyPreserveHost On
        ServerName app1.example.com
        ProxyPass / ajp://tcvh1:8082/
        ProxyPassReverse / ajp://tcvh1:8082/

</VirtualHost>

<VirtualHost *:80>
        #ProxyPreserveHost On
        ServerName app2.example.com
        ProxyPass / ajp://tcvh2:8082/
        ProxyPassReverse / ajp://tcvh2:8082/
</VirtualHost>

Tomcat :

I have the applications deployed as:
app1 — $CATALINA_HOME/tcvh1/ROOT.war
app2 — $CATALINA_HOME/tcvh2/ROOT.war

Now,
If I changed the tomcat to run on port 8080, and changed the proxy pass to connect to http://tcvh1:8080, then it works. but if I used the configuration with AJP, it does NOT work.

Why does my host alias not work with AJP? is there a way to make it work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:09:34+00:00Added an answer on June 3, 2026 at 8:09 am

    It doesn’t work because the mod_proxy_ajp always passes the host header received by httpd to Tomcat whereas the mod_proxy_http will use the host defined in the ProxyPass unless ProxyPreserveHost is set to On.

    Since – as far as httpd is concerned – your virual hosts are app1.example.com and app2.example.com, these are what get passed to your Tomcat instance. Tomcat has no record of these virtual hosts. It has tcvh1 and tcvh2. Therefore all the requests will get routed to the default virtual host (which ever one is defined on your Engine element in server.xml).

    There are several ways to fix this:

    1. Rename you Tomcat virtual hosts to match your httpd virtual hosts
    2. Add aliases ( see http://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Host_Name_Aliases) to your Tomcat virtual hosts.

    Personally, I’d go with option 2. Quicker and simpler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have two servers, both are containing a local application connecting to local web
I have a flex application that communicates via BlazeDS with two webapps running inside
Does anybody know why when connecting two dial-up modems the maximum protocol you can
I have two web applications running in same Servlet container ( Tomcat ), A
I have two applications deployed on tomcat. For each application I have defined their
I've decided to implement my own interface for connecting two devices running my game,
I have implemented the two classes shown at http://tomcat.apache.org/tomcat-6.0-doc/aio.html which gives a messenger application
I'm running load tests for my application. I have two servers: one with my
I have two Virtual machines on an external server. VM1 is the Tomcat server
I'm attempting to write an app that involves connecting two android devices via bluetooth.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.