You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dmitry Beransky <dm...@gmail.com> on 2008/01/09 19:10:56 UTC

mod_jk and Host matches server name

I've seen many references to this problem, but since the message is an
umbrella to many possible problems, nothing of what I've read so far
offers a solution for my particular symptoms.

In the back I've got Tomcat 5.5.23 with default configuration:
   1. default host is "localhost"
   2. HTTP connector on 8080
   3. AJP connector on 8009

   After reading a message, I also added an alias to <Host> just to be sure.

   the application is deployed from a war into the default context
with ROOT.xml descriptor

On the front, I have Apache 2.2.4 with mod_jk 1.2.26 built from source
(I needed a 64 bit version that would work with apache 2.2.4)

Now, here are the symptoms:

- Connecting to tomcat directly on the localhost interface:  gets content
- Connecting to tomcat directly on eth0:                            gets content
- Connecting via mod_jk with worker.host=localhost:          400 No
Host matches server name
- Connecting via mod_jk with worker.host=10.10.1.12:        400 No
Host matches server name

(The details of these tests are below)

Any ideas what's going on here?

Thanks
Dmitry


-----------------------------------------------------------------------------
Connecting directly to tomcat on the localhost interface:

$ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
GET / HTTP/1.1
Host: jira1

HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=365B38ABA34CBC8A1B3B9B456704517B; Path=/
Location: http://jira1/secure/Dashboard.jspa
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
Connecting to tomcat on the eth0 interface:

$ telnet jira1 8080
Trying 10.10.1.12...
Connected to europe.travelsecure.local (10.10.1.12).
Escape character is '^]'.
GET / HTTP/1.1
Host: jira1

HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=BE2BE7AE2BFDF59EE393D6D76D8DF278; Path=/
Location: http://jira1/secure/Dashboard.jspa
Content-Type: text/html;charset=UTF-8
Content-Length: 0
Date: Wed, 09 Jan 2008 17:42:09 GMT
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
Connecting via mod_jk through jira1 host interface with the worker
connecting on eth0

worker.worker_normal.type=ajp13                         #
worker.worker_normal.host=europe                        #
worker.worker_normal.port=8009                          #

[dqb@europe Jira]$ telnet jira1 80
Trying 10.10.1.12...
Connected to europe.travelsecure.local (10.10.1.12).
Escape character is '^]'.
GET / HTTP/1.1
Host: jira1

HTTP/1.1 400 No Host matches server name jira1
Date: Wed, 09 Jan 2008 17:48:08 GMT
Server: Apache/2.2.3 (CentOS)
Connection: close
Transfer-Encoding: chunked
Content-Type: text/plain; charset=UTF-8

from mod_jk.log:

[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
init_ws_service::mod_jk.c (888): Service protocol=HTTP/1.1 method=GET
host=(null) addr=10.10.1.12 name=jira1 port=80 auth=(null) user=(null)
laddr=10.10.1.12 raddr=10.10.1.12 uri=/
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_get_endpoint::jk_ajp_common.c (2579): acquired connection pool
slot=0
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_marshal_into_msgb::jk_ajp_common.c (553): ajp marshaling done
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_service::jk_ajp_common.c (2050): processing worker_normal with 2
retries
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_send_request::jk_ajp_common.c (1352): (worker_normal) all
endpoints are disconnected, detected by connect check (0), cping (0),
send (0)
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
jk_open_socket::jk_connect.c (448): socket TCP_NODELAY set to On
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
jk_open_socket::jk_connect.c (548): trying to connect socket 23 to
10.10.1.12:8009
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
jk_open_socket::jk_connect.c (574): socket 23 connected to
10.10.1.12:8009
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connect_to_endpoint::jk_ajp_common.c (878): Connected socket 23 to
(10.10.1.12:8009)
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): sending to
ajp13 pos=4 len=66 max=8192
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0000    12 34
00 3E 02 02 00 08 48 54 54 50 2F 31 2E 31  - .4.>....HTTP/1.1
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0010    00 00
01 2F 00 00 0A 31 30 2E 31 30 2E 31 2E 31  - .../...10.10.1.1
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0020    32 00
FF FF 00 05 6A 69 72 61 31 00 00 50 00 00  - 2.....jira1..P..
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0030    02 A0
0B 00 05 6A 69 72 61 31 00 A0 08 00 01 30  - .....jira1.....0
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0040    00 FF
00 00 00 00 00 00 00 00 00 00 00 00 00 00  - ................
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_send_request::jk_ajp_common.c (1395): (worker_normal) request body
to send 0 - request body to resend 0
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1117): received from
ajp13 pos=0 len=41 max=8192
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1117): 0000    04 01
90 00 21 4E 6F 20 48 6F 73 74 20 6D 61 74  - ....!No.Host.mat
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1117): 0010    63 68
65 73 20 73 65 72 76 65 72 20 6E 61 6D 65  - ches.server.name
[Wed Jan 09 09:48:12 2008] [14014:2934367456] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1117): 0020    20 6A
69 72 61 31 00 00 0
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
Connecting via mod_jk through jira1 host interface with the worker
connecting on localhost

worker.worker_normal.type=ajp13                         #
worker.worker_normal.host=localhost                        #
worker.worker_normal.port=8009                          #

[dqb@europe Jira]$ telnet jira1 80
Trying 10.10.1.12...
Connected to europe.travelsecure.local (10.10.1.12).
Escape character is '^]'.
GET / HTTP/1.1
Host: jira1

HTTP/1.1 400 No Host matches server name jira1
Date: Wed, 09 Jan 2008 17:49:29 GMT
Server: Apache/2.2.3 (CentOS)
Connection: close
Transfer-Encoding: chunked
Content-Type: text/plain; charset=UTF-8

from mod_jk log:

[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
init_ws_service::mod_jk.c (888): Service protocol=HTTP/1.1 method=GET
host=(null) addr=10.10.1.12 name=jira1 port=80 auth=(null) user=(null)
laddr=10.10.1.12 raddr=10.10.1.12 uri=/
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_get_endpoint::jk_ajp_common.c (2579): acquired connection pool
slot=0
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_marshal_into_msgb::jk_ajp_common.c (553): ajp marshaling done
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_service::jk_ajp_common.c (2050): processing worker_normal with 2
retries
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_send_request::jk_ajp_common.c (1352): (worker_normal) all
endpoints are disconnected, detected by connect check (0), cping (0),
send (0)
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
jk_open_socket::jk_connect.c (448): socket TCP_NODELAY set to On
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
jk_open_socket::jk_connect.c (548): trying to connect socket 23 to
127.0.0.1:8009
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
jk_open_socket::jk_connect.c (574): socket 23 connected to
127.0.0.1:8009
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_connect_to_endpoint::jk_ajp_common.c (878): Connected socket 23 to
(127.0.0.1:8009)
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): sending to
ajp13 pos=4 len=66 max=8192
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0000    12 34
00 3E 02 02 00 08 48 54 54 50 2F 31 2E 31  - .4.>....HTTP/1.1
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0010    00 00
01 2F 00 00 0A 31 30 2E 31 30 2E 31 2E 31  - .../...10.10.1.1
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0020    32 00
FF FF 00 05 6A 69 72 61 31 00 00 50 00 00  - 2.....jira1..P..
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0030    02 A0
0B 00 05 6A 69 72 61 31 00 A0 08 00 01 30  - .....jira1.....0
[Wed Jan 09 09:49:34 2008] [14095:2934367456] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): 0040    00 FF
00 00 00 00 00 00 00 00 00 00 00 00 00 00  - ................
[

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


Re: mod_jk and Host matches server name

Posted by Dmitry Beransky <dm...@gmail.com>.
Just want to document the solution for folks facing the same problem
in the future.  Actually, it turned out to be quite nasty, in part
because I wasn't paying much attention to the logs which were giving
warnings that the AJP port was already bound.  Being used to Tomcat
failing to start when it hits a used port, I glazed over these
warnings.  Apparently, Tomcat will only fail to start when either the
shutdown port or the http connector port are used, but will still
continue with a warning if it can't bind a port for an AJP connector.

The problem was caused by another application, VMWare's web admin
console, using port 8009 for it's own needs.  The problem was
compounded by the fact that VMWare installed an AJP listener on that
port.  That's why it was responding to Apache's inquiries, but with an
error message.

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