tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Tomcat as a proxy server
Date Mon, 24 Jul 2006 09:33:06 GMT

McHugh, Jason wrote:
> I want to run straight tomcat as a proxy server.  (I understand that there are a variety
of other applications out there that may perform better and offer more features.  I also understand
that I could front tomcat with apache and do some sort of rewriting solution.  I'd rather
not do any of these; I just want to use plain tomcat.  :) )
> I've written a servlet and overridden the commonly used default servlet 'org.apache.catalina.servlets.DefaultServlet'
with my own.  All of this is working fine.
> The problem occurs when I run my server as a proxy server.  Web browsers will make the
request for "" look something like this:
> GET HTTP/1.1
> Accept: */*
> Accept-Language: en-us
> Host:
> (there are other parts to it, but really this is all that matters.)  My tomcat responds
> HTTP/1 1 400 No Host matches server name
> Server: Apache-Coyote/1.1
> Transfer-Encoding: chunked
> Date: Sat, 22 Jul 2006 20:10:26 GMT
> Connection: close
> Because, of course, my server host name is not
> I've read the documentation and a good deal of the source code and now understand that
org.apache.catalina.core.StandardEngine has associated with it a set of Hosts each which is
configured with one or more host names (usually one but org.apache.catalina.core.StandardHost
supports 'host name aliases').  If the Engine cannot find a host matching the "Host" http
header then it will respond back with the result above.  (I guess it is a bit more complicated
than this since my traces through the code show other classes, like host-manager, getting
in the mix.)
> I expected that Tomcat could accomplish what I am trying to do purely with configuration
but after reading through the documentation, FAQs, and much of the catalina code, I can't
find the solution.  (The one solution that I have come up with, involving subclassing the
org.apache.catalina.core.StandardHost class and overriding the 'findChild' method, feels hacky
and like I said -- I thought that I should be able to do what I want using config only.)
> To summarize - I would like to configure my tomcat instance to call my servlet independent
of the URL or http "host" header which tomcat receives.  Does anyone know how to do this?

Do you have a default host configured?

<Engine defaultHost="proxyProcessorHost"...


> Thanks.
> Jason McHugh
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message