1 Reply Latest reply on Jan 23, 2009 5:47 AM by Jan Nielsen

    Wrong redirects for HTTP/1.0 clients when running through AJ

    Jan Nielsen Newbie

      Summary: When running JBoss 4.2 through an AJP/1.3 connector, JBoss 4.2 sends meaningless redirects to HTTP/1.0 clients if they didn't include Host header.

      Detailed explanation:

      I'm running Debian Linux "etch" with Sun's JDK 1.6u11, Apache2.2 + mod_jk, JBoss 4.2.3 (JDK 6 version). I've created a simple webapp directory in the deploy folder named ROOT.war, and it includes a single file named index.jsp with this contents:

      <% response.sendRedirect("/test"); %>


      After starting up JBoss, I make an HTTP/1.0 request for the URL /:

      jbosstest:~# telnet localhost 80
      Trying 127.0.0.1...
      Connected to localhost.
      Escape character is '^]'.
      GET / HTTP/1.0
      
      HTTP/1.1 302 Moved Temporarily
      Date: Thu, 22 Jan 2009 17:04:53 GMT
      Server: Apache/2.2.3 (Debian) mod_jk/1.2.18
      X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)/JBossWeb-2.0
      Set-Cookie: JSESSIONID=F4EF264027A06BC0A34849F7E2683BFE; Path=/
      Location: http://localhost:8009/test
      Content-Length: 0
      Connection: close
      Content-Type: text/html;charset=ISO-8859-1
      
      Connection closed by foreign host.


      The response is (as expected) a redirect to /test, but the hostname (localhost) and port (8009) are meaningless.

      If I include the Host header in the request (this is not required for HTTP/1.0 requests) or make any HTTP/1.1 request (which will includes the Host header), the server has the expected behavior and sends a redirect to the server itself (in my case jbosstest.mydomain) on the correct port (80). Also, this is only an issue when running through the AJP/1.3 connector, the HTTP/1.1 connector works fine.

      I've checked with other JBoss versions, and all versions from the 4.2 and 5 series has this behavior. The latest 4.0 version (4.0.5.GA) sends the correct redirect in all cases, so this issue seems to have been introduced in the JBoss 4.2 series (which switched from Tomcat 5.5 to JBossWeb 2.0).

      Does anyone know how to fix this? It seems this new behaviour is useless to some or all HTTP/1.0 clients.