Hi,

I have a problem with configuring mod_proxy_ajp to access Tomcat5 through 
Apache2. My setup:

CentOS release 5.4 (Final)
httpd-2.2.3-31.el5.centos.4
tomcat5-5.5.23-0jpp.7.el5_3.2

I have in /etc/httpd/conf.d/proxy_ajp.conf:

<Location /tomcat/>
  ProxyPass             ajp://localhost:8009/
  ProxyPassReverse      ajp://localhost:8009/
</Location>

i.e., I want all my Tomcat webapps accessible behind a /tomcat location.


Now if I try

------------ cut ----------------- cut --------------
>wget http://copper/tomcat/admin
--2010-05-04 15:11:30--  http://copper/tomcat/admin
Resolving copper... 10.156.31.49
Connecting to copper|10.156.31.49|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://copper/admin/ [following]
--2010-05-04 15:11:30--  http://copper/admin/
Connecting to copper|10.156.31.49|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2010-05-04 15:11:30 ERROR 404: Not Found.
------------ cut ----------------- cut --------------

I get a 404 because the URL in incorrectly redirected.
If I try to access directly 

------------ cut ----------------- cut --------------
>wget http://copper/tomcat/admin/
--2010-05-04 15:14:15--  http://copper/tomcat/admin/
Resolving copper... 10.156.31.49
Connecting to copper|10.156.31.49|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2504 (2.4K) [text/html]
Saving to: `index.html'
2010-05-04 15:14:15 (13.4 MB/s) - `index.html' saved [2504/2504]
------------ cut ----------------- cut --------------

I receive something, however it doesn't work since the answer contains

<head>
  <base href="http://copper/admin/login.jsp";>
</head>

which is wrong.

To alleviate this I tried to modify the AJP connector in web.xml:

  <Connector port="8009"
        proxyName="copper/tomcat" proxyPort="80"
        enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

It seems to work better however I receive "HTTP Status 408, he time allowed for 
the login process has been exceeded" which seems to indicate the cookie is not 
transmitted correctly. This could be related to the "Attempt to fake the path" 
that is shown by wget:

------------ cut ----------------- cut --------------
4MAL00298:~/test>wget -d http://copper/tomcat/admin/
DEBUG output created by Wget 1.11.4 on cygwin.

--2010-05-04 15:19:16--  http://copper/tomcat/admin/
Resolving copper... 10.156.31.49
Caching copper => 10.156.31.49
Connecting to copper|10.156.31.49|:80... connected.
Created socket 3.
Releasing 0x006d91f0 (new refcount 1).

---request begin---
GET /tomcat/admin/ HTTP/1.0
User-Agent: Wget/1.11.4
Accept: */*
Host: copper
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 200 OK
Date: Tue, 04 May 2010 14:19:16 GMT
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 WET
Set-Cookie: JSESSIONID=80BF7B0E2875A3CFD025DA77EF051F71; Path=/admin
Content-Type: text/html;charset=utf-8
Content-Length: 2467
Connection: close

---response end---
200 OK
Attempt to fake the path: /admin, /tomcat/admin/
Length: 2467 (2.4K) [text/html]
Saving to: `index.html.2'
Closed fd 3
2010-05-04 15:19:16 (13.8 MB/s) - `index.html.2' saved [2467/2467]
------------ cut ----------------- cut --------------

So what gives? Is this all because I want my URL to be slighlty rewritten? Does 
nobody ever do that?

Thanks for your help,
Chris

Reply via email to