Forum Moderators: phranque

Message Too Old, No Replies

Proxying from Apache to Tomcat

         

Kai_Behncke

12:45 pm on Jun 2, 2009 (gmt 0)

10+ Year Member



Dear users,

I`m using Apache 2.2 and for a specific application it`s necessary to "jump" to a Tomcat-server (5.5) via a proxy.

Well, I need to say that I´m a total "Tomcat-newbie".

The tomcat-application is at:

http://www.example.com:8180/webapps/print-servlet.1.1/info.json (that gives me no error)

I try two ways (so far without success)

1.) MOD_PROXY

In my Apache I enabled the modules "proxy" and "rewrite" and I try:

RewriteEngine On
RewriteRule /tomcat/(.*) http://www.example.com:8180/$1 [P]
<Proxy *>
Order allow,deny
Allow from all
</Proxy>

But http://www.example.com/tomcat/webapps/print-servlet.1.1/info.json

gives me an Error 403 "Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server."

Has anybody an idea how to solve that problem?

2.) CGI-SKRIPT

I have an executable cgi-script.

e.g. that works well:

http://www.example.com/cgi-bin/proxy2.cgi?url=http://demo.mapfish.org/mapfishsample/1.1/mapfish.png

or also that:

http://www.example.com/cgi-bin/proxy2.cgi?url=http://www.example.com/test/test.html

But if I try to use my tomcat-application:

http://www.example.com/cgi-bin/proxy2.cgi?url=http://www.example.com:8180/webapps/print-servlet.1.1/info.json

I get:

"Some unexpected error occurred. Error text was: HTTP Error 400: No Host matches server name www.example.com"

Has anybody an idea how to clear these problems?

Thank you very much, Kai

[edited by: jdMorgan at 12:41 pm (utc) on June 4, 2009]
[edit reason] example.com [/edit]

Kai_Behncke

11:36 am on Jun 4, 2009 (gmt 0)

10+ Year Member



Ok, problem solved, I had forgotten to install also mod_proxy_http (and have a look if you have mods-available/proxy.conf on your server!)).

"Some unexpected error occurred. Error text was: HTTP Error 400: No Host matches server name...." came beacuse tomcat was not running well. You need to define JAVA_HOME and install tomcat correctly, e.g. via:

apt-get install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps

Best regards, Kai

g1smd

12:24 pm on Jun 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Nice cryptic error messages there!