tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@agents.ICS.UCI.EDU
Subject Tomcat as proxy
Date Thu, 29 Jun 2000 04:36:57 GMT

(I've been an avid user of apache software for 5 years, but am a
newcomer to this group. I haven't found anything in the archives or
the FAQ that addresses my question below.)

I'm working on a project to build a web crawler that learns by
watching users browse. To do the "watch users" part, I need a proxy
server, and I'm attempting to use Tomcat 3.1 for this purpose.

I've written a proxy servlet (let's call it Proxy) that operates at
the root, and this works fine as long as I'm invoking it
directly. When a request comes in to,
Proxy is called to handle it. However, when I set my browser so that is my HTTP proxy, Proxy is no longer invoked.
Instead, I get a generic error 400. The logs at the highest level of
detail give absolutely no information about what happens.

Right now, I have a bizarre workaround: I added a "error message" path
to the web-app and mapped the error path back to the Proxy servlet
itself. Amazingly this seems to work, although I haven't fully
investigated if I'm losing any bits of the request through this
indirection. Obviously, this is an extremely weak solution: any real
servlet error will generate an infinite loop. :-o

I'm trying to figure out why this happens. The only difference between
the two situations AFAIK is that the "Host:" header in first case is
"", the local host where the server is actually running,
and in the second case, the "Host:" header is set to the originating
server that proxy is supposed to contact.

So here's the question: is there someplace in the code that checks the
Host header to see if a request is coming to the "right" server? And
if so, can that be turned off? If there is no such test, what explains
the difference in the two situations?

(I originally made the decision to pursue this solution when I was
using either JSDK or an earlier version of Tomcat [don't remember].
But I do remember that the proxying didn't generate an error then. I'm
aware that another solution would be to use Apache's built-in
proxying, but I'm hoping for an all-Java solution here.)

Any ideas appreciated. Thanks,


University of California, Irvine
Information and Computer Science Dept.

"The universe is made of stories, not of atoms" - Muriel Rukeyser

View raw message