You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by de...@hanik.com on 2005/12/23 22:53:59 UTC

Re: How to forward external-ip-facing requests from ApacheHTTPServer to Tomcat?

use mod_proxy, much easier, and in our tests has proven to scale better,
and you will wanna look for a directive called ProxyHostPreserve so that
request.getServerName returns the right name,
then the IP address will be stored in x-forwarded-for header in the HTTP
request.

Filip

> Hello Everyone,
>
> I have successfully configured Apache to forward requests to my Tomcat
> instance. But it does so...only for requests whose IP resolves to
> 127.0.0.1
>
> If I try to access a page through apache server (that's actually on
> tomcat)
> with the outside-facing-ip of my computer it fails.
>
> For example:
> 1) URL: "http://12.34.56.78:666/blah/serveMe.html"            FAILS with a
> 404 (apache does not forward properly)
>
> 2) URL: "http://12.34.56.78:8080/blah/serveMe.html"           SUCCEEDS
> (tomcat seems to be ok when it gets the request directly, so it has to be
> a
> forwarding failure by apache in the previous case)
>
> 3) URL: "http://my.domain.com:666/blah/serveMe.html"      SUCCEEDS (I have
> "
> my.domain.com" mapped to "127.0.0.1" in my windows' hosts file)
>
> 4) URL: "http://localhost:666/blah/serveMe.html"                SUCCEEDS
>
> I think this happens because the 1st request (the one with the outside
> facing ip) is not forwarded to Tomcat by apache.
> a) The apache error logs show that Apache is trying to look for the page
> in
> the wrong place
> b) The access logs ofcourse show a 404 because it can't find the page to
> serve
>
> Now, I have read a few threads and been on a few forums and apparently my
> worker.properties file is supposed to be as simple as this:
> ------------------------
> worker.list=ajp13
> worker.ajp13.port=8009
> worker.ajp13.host=my.domain.com
> worker.ajp13.type=ajp13
> -----------------------
>
> I also tried putting my outside-facing-ip and localhost as values for "
> worker.ajp13.host" but it didn't seem to make any difference at all.
>
> In that case I must ask all of you:
> Question 1: How do I go about configuring apache to forward the
> outside-facing-ip requests to Tomcat? If it is not done in
> workers.properties...then where is it handled?
> Question 2: Or am I wrong and it is actually handled by
> workers.properties?
> Even then, how?
>
> Thanks in advance to all those who answer and all those who take the time
> to
> read this.
>
> Cheers,
> - Pulkit
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to forward external-ip-facing requests from ApacheHTTPServer to Tomcat?

Posted by Daniel Blumenthal <da...@wordchamp.com>.
Pulkit,

I don't have any experience with WinServer (strictly a Linux man), but if it
works...  Also, it was my understanding (last time I checked) that no one's
maintaining the old jk connector code - possibly because your method is now
the recommended way?  I don't know.

Good luck!

Daniel

> -----Original Message-----
> From: Pulkit Singhal [mailto:pulkitsinghal@gmail.com] 
> Sent: Sunday, December 25, 2005 6:29 PM
> To: Tomcat Users List; daniel@wordchamp.com
> Subject: Re: How to forward external-ip-facing requests from 
> ApacheHTTPServer to Tomcat?
> 
> Hi Daniel,
> 
> Firstly, Thank you for your response.
> 
> Secondly, I must confess that I failed to grasp some of it 
> due to my ignorance of Unix. I understood the overall idea 
> but found myself scared/hesitant in implementing it as I'm 
> using Win Server 2003. I'm a bit perplexed by the contents 
> you said I could add to workers2.properties as I was not 
> aware that fields were acceptable in such format. May be its 
> the type of connector you are using or maybe its just my lack 
> of experience/knowledge.
> 
> I did find a soulution of ***sorts** which I would like to 
> share with all of you so that you may comment/bash on its 
> weaknesses/lamenesses thus helping me in finding a better one:
> 
> *sigh* I just:
> 
> a) Removed the "127.0.0.1    my.server.com" mapping from the 
> hosts file.
> 
> b) Added another Virtual Host to my server.xml 
> file...resulting in something like this:
> 
>             <!-- Define the default virtual host -->
>             <Host name="localhost" ...>
>                 <Listener 
> className="org.apache.jk.config.ApacheConfig"
>                           
> modJk="c:/apps/apache/apache2/modules/mod_jk-
> apache-2.0.55.so" />
>             </Host>
> 
>             <!-- Define the hack virtual host for external-facing-ip
> requests>
>             <Host name="my.server.com" ...>
>                 <Listener 
> className="org.apache.jk.config.ApacheConfig"
>                           
> modJk="c:/apps/apache/apache2/modules/mod_jk-
> apache-2.0.55.so" />
>             </Host>
> 
> c) This happened to do the job, as now the file that Tomcat 
> was auto-generating for use by Apache had some lines that 
> accounted for the proper forwarding of external-facing-ip 
> requests as well :) These were not there earlier and the file 
> I speak of is "tomcat_home\conf\auto\mod_jk.conf" )
> 
> d) I still feel a bit jilted because my solution seems 
> repetitive...there are 2 virtual hosts that are located in 
> the exact same place and to top it off they have the same 
> listeners inside them. They are identical in every aspect.
> I HAD tried entering <Alias>my.server.com</Alias> under the 
> localhost virtual-host but that did not seem to do the job... 
> so I settled for having this repitition.
> 
> Do let me know of your thoughts on this...
> 
> Cheers,
> - Pulkit
> 
> On 12/25/05, Daniel Blumenthal <da...@wordchamp.com> wrote:
> >
> > I've set up my system so that Apache handles all requests, and 
> > forwards to the servlet when the path is www.mysite.com/myservlet/*.
> >
> > Following are my installation notes.
> > (note that there's a slightly newer version of the JK connector)
> >
> > % tar zxf jakarta-tomcat-connectors-jk2-src-current.tar.gz
> > % cd jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2
> > % ./configure --with-apxs2=/usr/local/apache/bin/apxs
> > % make
> > % su
> > % cp ../build/jk2/apache2/mod_jk2.so /usr/local/apache/modules % cp 
> > ../build/jk2/apache2/jkjni.so /usr/local/apache/modules
> >
> > make sure that httpd owns the apache directory
> >
> > tomcat/server.xml: make sure that the following connector 
> is uncommented:
> >   <Connector 
> className="org.apache.ajp.tomcat4.Ajp13Connector" port="8009"
> > minProcessors="5" maxProcessors="75" acceptCount="10" debug="0"/>
> >
> > create a "workers2.properties" file in 
> /usr/local/apache/conf with the 
> > following contents:
> >   [logger]
> >   level=DEBUG
> >   [shm]
> >   file=/usr/local/apache/logs/jk2.shm
> >   size=1048576
> >   [channel.socket:localhost:8009]
> >   info=Ajp13 forwarding over socket
> >   tomcatId=localhost:8009
> >   [uri:/myservlet/*]
> >   context=/myservlet
> >
> > % touch /usr/local/apache/logs/jk2.shm % chown httpd 
> > /usr/local/apache/logs/jk2.shm % chgrp httpd 
> > /usr/local/apache/logs/jk2.shm
> >
> > add the following line to /usr/local/apache/conf/httpd.conf:
> >   LoadModule jk2_module modules/mod_jk2.so
> >
> >
> > I hope this helps.
> >
> > Daniel
> >
> >
> > > -----Original Message-----
> > > From: Pulkit Singhal [mailto:pulkitsinghal@gmail.com]
> > > Sent: Sunday, December 25, 2005 1:12 PM
> > > To: Tomcat Users List
> > > Subject: Re: How to forward external-ip-facing requests from 
> > > ApacheHTTPServer to Tomcat?
> > >
> > > Hi,
> > >
> > > Thank you for the suggestion :)
> > > I will give it a shot but I am really too deep into my 
> setup to be 
> > > doing any big changes or something new! So while I try to 
> google and 
> > > learn more about setting up mod_proxy, I would really 
> appreciate if 
> > > someone can tell me:
> > >
> > > How do I go about configuring apache to forward the 
> > > outside-facing-ip requests to Tomcat through JK connector?
> > >
> > > This should be something pretty standard for anyone who has ever 
> > > moved Tomcat from a local testing env. (localhost) to a 
> production 
> > > env. (real ip) ...right?
> > >
> > > Thanks,
> > > - Pulkit
> > >
> > > On 12/23/05, devlists@hanik.com <de...@hanik.com> wrote:
> > > >
> > > > use mod_proxy, much easier, and in our tests has proven 
> to scale 
> > > > better, and you will wanna look for a directive called 
> > > > ProxyHostPreserve so that request.getServerName returns 
> the right 
> > > > name, then the IP address will be stored in x-forwarded-for
> > > header in
> > > > the HTTP request.
> > > >
> > > > Filip
> > > >
> > > > > Hello Everyone,
> > > > >
> > > > > I have successfully configured Apache to forward 
> requests to my 
> > > > > Tomcat instance. But it does so...only for requests whose IP 
> > > > > resolves to
> > > > > 127.0.0.1
> > > > >
> > > > > If I try to access a page through apache server (that's
> > > actually on
> > > > > tomcat)
> > > > > with the outside-facing-ip of my computer it fails.
> > > > >
> > > > > For example:
> > > > > 1) URL: "http://12.34.56.78:666/blah/serveMe.html"
> > >     FAILS with
> > > > a
> > > > > 404 (apache does not forward properly)
> > > > >
> > > > > 2) URL: "http://12.34.56.78:8080/blah/serveMe.html"
> > >     SUCCEEDS
> > > > > (tomcat seems to be ok when it gets the request directly,
> > > so it has
> > > > > to
> > > > be
> > > > > a
> > > > > forwarding failure by apache in the previous case)
> > > > >
> > > > > 3) URL: "http://my.domain.com:666/blah/serveMe.html"
> > > SUCCEEDS (I
> > > > have
> > > > > "
> > > > > my.domain.com" mapped to "127.0.0.1" in my windows' 
> hosts file)
> > > > >
> > > > > 4) URL: "http://localhost:666/blah/serveMe.html"
> > >       SUCCEEDS
> > > > >
> > > > > I think this happens because the 1st request (the one 
> with the 
> > > > > outside facing ip) is not forwarded to Tomcat by apache.
> > > > > a) The apache error logs show that Apache is trying to
> > > look for the
> > > > > page in the wrong place
> > > > > b) The access logs ofcourse show a 404 because it 
> can't find the 
> > > > > page to serve
> > > > >
> > > > > Now, I have read a few threads and been on a few forums and 
> > > > > apparently
> > > > my
> > > > > worker.properties file is supposed to be as simple as this:
> > > > > ------------------------
> > > > > worker.list=ajp13
> > > > > worker.ajp13.port=8009
> > > > > worker.ajp13.host=my.domain.com
> > > > > worker.ajp13.type=ajp13
> > > > > -----------------------
> > > > >
> > > > > I also tried putting my outside-facing-ip and localhost
> > > as values for "
> > > > > worker.ajp13.host" but it didn't seem to make any
> > > difference at all.
> > > > >
> > > > > In that case I must ask all of you:
> > > > > Question 1: How do I go about configuring apache to 
> forward the 
> > > > > outside-facing-ip requests to Tomcat? If it is not done in 
> > > > > workers.properties...then where is it handled?
> > > > > Question 2: Or am I wrong and it is actually handled by 
> > > > > workers.properties?
> > > > > Even then, how?
> > > > >
> > > > > Thanks in advance to all those who answer and all those
> > > who take the
> > > > time
> > > > > to
> > > > > read this.
> > > > >
> > > > > Cheers,
> > > > > - Pulkit
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > 
> --------------------------------------------------------------------
> > > -
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> > >
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to forward external-ip-facing requests from ApacheHTTPServer to Tomcat?

Posted by Pulkit Singhal <pu...@gmail.com>.
Hi Daniel,

Firstly, Thank you for your response.

Secondly, I must confess that I failed to grasp some of it due to my
ignorance of Unix. I understood the overall idea but found myself
scared/hesitant in implementing it as I'm using Win Server 2003. I'm a bit
perplexed by the contents you said I could add to workers2.properties as I
was not aware that fields were acceptable in such format. May be its the
type of connector you are using or maybe its just my lack of
experience/knowledge.

I did find a soulution of ***sorts** which I would like to share with all of
you so that you may comment/bash on its weaknesses/lamenesses thus helping
me in finding a better one:

*sigh* I just:

a) Removed the "127.0.0.1    my.server.com" mapping from the hosts file.

b) Added another Virtual Host to my server.xml file...resulting in something
like this:

            <!-- Define the default virtual host -->
            <Host name="localhost" ...>
                <Listener className="org.apache.jk.config.ApacheConfig"
                          modJk="c:/apps/apache/apache2/modules/mod_jk-
apache-2.0.55.so" />
            </Host>

            <!-- Define the hack virtual host for external-facing-ip
requests>
            <Host name="my.server.com" ...>
                <Listener className="org.apache.jk.config.ApacheConfig"
                          modJk="c:/apps/apache/apache2/modules/mod_jk-
apache-2.0.55.so" />
            </Host>

c) This happened to do the job, as now the file that Tomcat was
auto-generating for use by Apache had some lines that accounted for the
proper forwarding of external-facing-ip requests as well :)
These were not there earlier and the file I speak of is
"tomcat_home\conf\auto\mod_jk.conf" )

d) I still feel a bit jilted because my solution seems repetitive...there
are 2 virtual hosts that are located in the exact same place and to top it
off they have the same listeners inside them. They are identical in every
aspect.
I HAD tried entering <Alias>my.server.com</Alias> under the localhost
virtual-host but that did not seem to do the job... so I settled for having
this repitition.

Do let me know of your thoughts on this...

Cheers,
- Pulkit

On 12/25/05, Daniel Blumenthal <da...@wordchamp.com> wrote:
>
> I've set up my system so that Apache handles all requests, and forwards to
> the servlet when the path is www.mysite.com/myservlet/*.
>
> Following are my installation notes.
> (note that there's a slightly newer version of the JK connector)
>
> % tar zxf jakarta-tomcat-connectors-jk2-src-current.tar.gz
> % cd jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2
> % ./configure --with-apxs2=/usr/local/apache/bin/apxs
> % make
> % su
> % cp ../build/jk2/apache2/mod_jk2.so /usr/local/apache/modules
> % cp ../build/jk2/apache2/jkjni.so /usr/local/apache/modules
>
> make sure that httpd owns the apache directory
>
> tomcat/server.xml: make sure that the following connector is uncommented:
>   <Connector className="org.apache.ajp.tomcat4.Ajp13Connector" port="8009"
> minProcessors="5" maxProcessors="75" acceptCount="10" debug="0"/>
>
> create a "workers2.properties" file in /usr/local/apache/conf with the
> following contents:
>   [logger]
>   level=DEBUG
>   [shm]
>   file=/usr/local/apache/logs/jk2.shm
>   size=1048576
>   [channel.socket:localhost:8009]
>   info=Ajp13 forwarding over socket
>   tomcatId=localhost:8009
>   [uri:/myservlet/*]
>   context=/myservlet
>
> % touch /usr/local/apache/logs/jk2.shm
> % chown httpd /usr/local/apache/logs/jk2.shm
> % chgrp httpd /usr/local/apache/logs/jk2.shm
>
> add the following line to /usr/local/apache/conf/httpd.conf:
>   LoadModule jk2_module modules/mod_jk2.so
>
>
> I hope this helps.
>
> Daniel
>
>
> > -----Original Message-----
> > From: Pulkit Singhal [mailto:pulkitsinghal@gmail.com]
> > Sent: Sunday, December 25, 2005 1:12 PM
> > To: Tomcat Users List
> > Subject: Re: How to forward external-ip-facing requests from
> > ApacheHTTPServer to Tomcat?
> >
> > Hi,
> >
> > Thank you for the suggestion :)
> > I will give it a shot but I am really too deep into my setup
> > to be doing any big changes or something new! So while I try
> > to google and learn more about setting up mod_proxy, I would
> > really appreciate if someone can tell me:
> >
> > How do I go about configuring apache to forward the
> > outside-facing-ip requests to Tomcat through JK connector?
> >
> > This should be something pretty standard for anyone who has
> > ever moved Tomcat from a local testing env. (localhost) to a
> > production env. (real ip) ...right?
> >
> > Thanks,
> > - Pulkit
> >
> > On 12/23/05, devlists@hanik.com <de...@hanik.com> wrote:
> > >
> > > use mod_proxy, much easier, and in our tests has proven to scale
> > > better, and you will wanna look for a directive called
> > > ProxyHostPreserve so that request.getServerName returns the right
> > > name, then the IP address will be stored in x-forwarded-for
> > header in
> > > the HTTP request.
> > >
> > > Filip
> > >
> > > > Hello Everyone,
> > > >
> > > > I have successfully configured Apache to forward requests to my
> > > > Tomcat instance. But it does so...only for requests whose IP
> > > > resolves to
> > > > 127.0.0.1
> > > >
> > > > If I try to access a page through apache server (that's
> > actually on
> > > > tomcat)
> > > > with the outside-facing-ip of my computer it fails.
> > > >
> > > > For example:
> > > > 1) URL: "http://12.34.56.78:666/blah/serveMe.html"
> >     FAILS with
> > > a
> > > > 404 (apache does not forward properly)
> > > >
> > > > 2) URL: "http://12.34.56.78:8080/blah/serveMe.html"
> >     SUCCEEDS
> > > > (tomcat seems to be ok when it gets the request directly,
> > so it has
> > > > to
> > > be
> > > > a
> > > > forwarding failure by apache in the previous case)
> > > >
> > > > 3) URL: "http://my.domain.com:666/blah/serveMe.html"
> > SUCCEEDS (I
> > > have
> > > > "
> > > > my.domain.com" mapped to "127.0.0.1" in my windows' hosts file)
> > > >
> > > > 4) URL: "http://localhost:666/blah/serveMe.html"
> >       SUCCEEDS
> > > >
> > > > I think this happens because the 1st request (the one with the
> > > > outside facing ip) is not forwarded to Tomcat by apache.
> > > > a) The apache error logs show that Apache is trying to
> > look for the
> > > > page in the wrong place
> > > > b) The access logs ofcourse show a 404 because it can't find the
> > > > page to serve
> > > >
> > > > Now, I have read a few threads and been on a few forums and
> > > > apparently
> > > my
> > > > worker.properties file is supposed to be as simple as this:
> > > > ------------------------
> > > > worker.list=ajp13
> > > > worker.ajp13.port=8009
> > > > worker.ajp13.host=my.domain.com
> > > > worker.ajp13.type=ajp13
> > > > -----------------------
> > > >
> > > > I also tried putting my outside-facing-ip and localhost
> > as values for "
> > > > worker.ajp13.host" but it didn't seem to make any
> > difference at all.
> > > >
> > > > In that case I must ask all of you:
> > > > Question 1: How do I go about configuring apache to forward the
> > > > outside-facing-ip requests to Tomcat? If it is not done in
> > > > workers.properties...then where is it handled?
> > > > Question 2: Or am I wrong and it is actually handled by
> > > > workers.properties?
> > > > Even then, how?
> > > >
> > > > Thanks in advance to all those who answer and all those
> > who take the
> > > time
> > > > to
> > > > read this.
> > > >
> > > > Cheers,
> > > > - Pulkit
> > > >
> > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: How to forward external-ip-facing requests from ApacheHTTPServer to Tomcat?

Posted by Daniel Blumenthal <da...@wordchamp.com>.
I've set up my system so that Apache handles all requests, and forwards to
the servlet when the path is www.mysite.com/myservlet/*.

Following are my installation notes.
(note that there's a slightly newer version of the JK connector)

% tar zxf jakarta-tomcat-connectors-jk2-src-current.tar.gz 
% cd jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2 
% ./configure --with-apxs2=/usr/local/apache/bin/apxs 
% make 
% su 
% cp ../build/jk2/apache2/mod_jk2.so /usr/local/apache/modules 
% cp ../build/jk2/apache2/jkjni.so /usr/local/apache/modules 

make sure that httpd owns the apache directory 

tomcat/server.xml: make sure that the following connector is uncommented: 
  <Connector className="org.apache.ajp.tomcat4.Ajp13Connector" port="8009"
minProcessors="5" maxProcessors="75" acceptCount="10" debug="0"/> 

create a "workers2.properties" file in /usr/local/apache/conf with the
following contents: 
  [logger] 
  level=DEBUG 
  [shm] 
  file=/usr/local/apache/logs/jk2.shm 
  size=1048576 
  [channel.socket:localhost:8009] 
  info=Ajp13 forwarding over socket 
  tomcatId=localhost:8009 
  [uri:/myservlet/*] 
  context=/myservlet 

% touch /usr/local/apache/logs/jk2.shm 
% chown httpd /usr/local/apache/logs/jk2.shm 
% chgrp httpd /usr/local/apache/logs/jk2.shm 

add the following line to /usr/local/apache/conf/httpd.conf: 
  LoadModule jk2_module modules/mod_jk2.so


I hope this helps.

Daniel
 

> -----Original Message-----
> From: Pulkit Singhal [mailto:pulkitsinghal@gmail.com] 
> Sent: Sunday, December 25, 2005 1:12 PM
> To: Tomcat Users List
> Subject: Re: How to forward external-ip-facing requests from 
> ApacheHTTPServer to Tomcat?
> 
> Hi,
> 
> Thank you for the suggestion :)
> I will give it a shot but I am really too deep into my setup 
> to be doing any big changes or something new! So while I try 
> to google and learn more about setting up mod_proxy, I would 
> really appreciate if someone can tell me:
> 
> How do I go about configuring apache to forward the 
> outside-facing-ip requests to Tomcat through JK connector?
> 
> This should be something pretty standard for anyone who has 
> ever moved Tomcat from a local testing env. (localhost) to a 
> production env. (real ip) ...right?
> 
> Thanks,
> - Pulkit
> 
> On 12/23/05, devlists@hanik.com <de...@hanik.com> wrote:
> >
> > use mod_proxy, much easier, and in our tests has proven to scale 
> > better, and you will wanna look for a directive called 
> > ProxyHostPreserve so that request.getServerName returns the right 
> > name, then the IP address will be stored in x-forwarded-for 
> header in 
> > the HTTP request.
> >
> > Filip
> >
> > > Hello Everyone,
> > >
> > > I have successfully configured Apache to forward requests to my 
> > > Tomcat instance. But it does so...only for requests whose IP 
> > > resolves to
> > > 127.0.0.1
> > >
> > > If I try to access a page through apache server (that's 
> actually on
> > > tomcat)
> > > with the outside-facing-ip of my computer it fails.
> > >
> > > For example:
> > > 1) URL: "http://12.34.56.78:666/blah/serveMe.html"        
>     FAILS with
> > a
> > > 404 (apache does not forward properly)
> > >
> > > 2) URL: "http://12.34.56.78:8080/blah/serveMe.html"       
>     SUCCEEDS
> > > (tomcat seems to be ok when it gets the request directly, 
> so it has 
> > > to
> > be
> > > a
> > > forwarding failure by apache in the previous case)
> > >
> > > 3) URL: "http://my.domain.com:666/blah/serveMe.html"      
> SUCCEEDS (I
> > have
> > > "
> > > my.domain.com" mapped to "127.0.0.1" in my windows' hosts file)
> > >
> > > 4) URL: "http://localhost:666/blah/serveMe.html"          
>       SUCCEEDS
> > >
> > > I think this happens because the 1st request (the one with the 
> > > outside facing ip) is not forwarded to Tomcat by apache.
> > > a) The apache error logs show that Apache is trying to 
> look for the 
> > > page in the wrong place
> > > b) The access logs ofcourse show a 404 because it can't find the 
> > > page to serve
> > >
> > > Now, I have read a few threads and been on a few forums and 
> > > apparently
> > my
> > > worker.properties file is supposed to be as simple as this:
> > > ------------------------
> > > worker.list=ajp13
> > > worker.ajp13.port=8009
> > > worker.ajp13.host=my.domain.com
> > > worker.ajp13.type=ajp13
> > > -----------------------
> > >
> > > I also tried putting my outside-facing-ip and localhost 
> as values for "
> > > worker.ajp13.host" but it didn't seem to make any 
> difference at all.
> > >
> > > In that case I must ask all of you:
> > > Question 1: How do I go about configuring apache to forward the 
> > > outside-facing-ip requests to Tomcat? If it is not done in 
> > > workers.properties...then where is it handled?
> > > Question 2: Or am I wrong and it is actually handled by 
> > > workers.properties?
> > > Even then, how?
> > >
> > > Thanks in advance to all those who answer and all those 
> who take the
> > time
> > > to
> > > read this.
> > >
> > > Cheers,
> > > - Pulkit
> > >
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to forward external-ip-facing requests from ApacheHTTPServer to Tomcat?

Posted by Pulkit Singhal <pu...@gmail.com>.
Hi,

Thank you for the suggestion :)
I will give it a shot but I am really too deep into my setup to be doing any
big changes or something new! So while I try to google and learn more about
setting up mod_proxy, I would really appreciate if someone can tell me:

How do I go about configuring apache to forward the outside-facing-ip
requests to Tomcat through JK connector?

This should be something pretty standard for anyone who has ever moved
Tomcat from a local testing env. (localhost) to a production env. (real ip)
...right?

Thanks,
- Pulkit

On 12/23/05, devlists@hanik.com <de...@hanik.com> wrote:
>
> use mod_proxy, much easier, and in our tests has proven to scale better,
> and you will wanna look for a directive called ProxyHostPreserve so that
> request.getServerName returns the right name,
> then the IP address will be stored in x-forwarded-for header in the HTTP
> request.
>
> Filip
>
> > Hello Everyone,
> >
> > I have successfully configured Apache to forward requests to my Tomcat
> > instance. But it does so...only for requests whose IP resolves to
> > 127.0.0.1
> >
> > If I try to access a page through apache server (that's actually on
> > tomcat)
> > with the outside-facing-ip of my computer it fails.
> >
> > For example:
> > 1) URL: "http://12.34.56.78:666/blah/serveMe.html"            FAILS with
> a
> > 404 (apache does not forward properly)
> >
> > 2) URL: "http://12.34.56.78:8080/blah/serveMe.html"           SUCCEEDS
> > (tomcat seems to be ok when it gets the request directly, so it has to
> be
> > a
> > forwarding failure by apache in the previous case)
> >
> > 3) URL: "http://my.domain.com:666/blah/serveMe.html"      SUCCEEDS (I
> have
> > "
> > my.domain.com" mapped to "127.0.0.1" in my windows' hosts file)
> >
> > 4) URL: "http://localhost:666/blah/serveMe.html"                SUCCEEDS
> >
> > I think this happens because the 1st request (the one with the outside
> > facing ip) is not forwarded to Tomcat by apache.
> > a) The apache error logs show that Apache is trying to look for the page
> > in
> > the wrong place
> > b) The access logs ofcourse show a 404 because it can't find the page to
> > serve
> >
> > Now, I have read a few threads and been on a few forums and apparently
> my
> > worker.properties file is supposed to be as simple as this:
> > ------------------------
> > worker.list=ajp13
> > worker.ajp13.port=8009
> > worker.ajp13.host=my.domain.com
> > worker.ajp13.type=ajp13
> > -----------------------
> >
> > I also tried putting my outside-facing-ip and localhost as values for "
> > worker.ajp13.host" but it didn't seem to make any difference at all.
> >
> > In that case I must ask all of you:
> > Question 1: How do I go about configuring apache to forward the
> > outside-facing-ip requests to Tomcat? If it is not done in
> > workers.properties...then where is it handled?
> > Question 2: Or am I wrong and it is actually handled by
> > workers.properties?
> > Even then, how?
> >
> > Thanks in advance to all those who answer and all those who take the
> time
> > to
> > read this.
> >
> > Cheers,
> > - Pulkit
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>