0 Replies Latest reply on Jan 9, 2007 9:06 PM by datagazetteer

    Does Seam know too much about its context? -- Apache Mod_Rew

    datagazetteer

      For various reasons -- enough reasons to be roadblocks to considering otherwise -- we need to front JBoss with Apache HTTPD. Some of these reasons also mean that we want the servlet application to appear it is at the root of the web server. When we had a straight Tomcat-hosted servlet, this bit of configuration on the webserver side worked:

       # Rewrite the URLs to proxy ("[P]") into the Tomcat server
       # The first RewriteRule handles home page requests
       # The second RewriteRule handles everything else
       RewriteEngine on
       RewriteRule ^/(;.*)?$ ajp://localhost:8009/app/home.seam$1 [P]
       RewriteRule ^(/.*) ajp://localhost:8009/app$1 [P]
      
       # Be prepared to rewrite the HTML/CSS files as they come back from Tomcat
       SetOutputFilter proxy-html
      
       # Rewrite JavaScript and CSS files in addition to HTML files
       ProxyHTMLExtended on
      
       # Rewrite HTTP headers and HTML/CSS links for the home page
       ProxyHTMLURLMap /app/home.seam /
       ProxyPassReverse /app/home.seam /
      
       # Rewrite HTTP headers and HTML/CSS links for everything else
       ProxyHTMLURLMap /app /
       ProxyPassReverse /app /
      


      With a Seam-based app, though, I'm seeing multiple redirects forcing the URL to include the context path. The series of HTTP requests below is an example of what happens when submitting a form on the home page (a.k.a. /app/home.seam or simply '/' as the client sees it after the ProxyHTMLURLMap processing):

      POST / HTTP/1.1
      Host: host.name.here
      Referer: http://host.name.here/
      Cookie: JSESSIONID=B1FF86EED9F5B69E812CD173B74010FE
      Content-Type: application/x-www-form-urlencoded
      Content-Length: 8258
      search%3Aq=sample&search%3Asearch=search&search_SUBMIT=1&search%3A_link_hidden_=&?
      jsf_tree_64=rO0ABXN...stuff...&jsf_state_64=rO0ABXV...more.stuff...&jsf_viewid=%2Fhome.xhtml
      
      HTTP/1.x 302 Moved Temporarily
      Date: Wed, 10 Jan 2007 01:24:35 GMT
      X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5
      Location: http://host.name.here/app/itemList.seam?cid=37
      Content-Length: 0
      Content-Type: text/plain
      Connection: close
      
      
      GET /app/itemList.seam?cid=37 HTTP/1.1
      Host: host.name.here
      Referer: http://host.name.here/
      Cookie: JSESSIONID=B1FF86EED9F5B69E812CD173B74010FE
      
      HTTP/1.x 404 /app/app/itemList.seam
      Date: Wed, 10 Jan 2007 01:24:36 GMT
      X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5
      Content-Type: text/html;charset=utf-8
      Connection: close
      


      (The request headers that had no direct bearing on the problem were removed.)

      Does this look normal? Can you think of any reason why Seam would be treated differently by the ProxyHTMLURLMap process?