3 Replies Latest reply on Feb 2, 2007 8:06 PM by shane.bryzak

    Seam via Apache and ProxyPass/ProxyPassReverse not working

    datagazetteer

      I'm trying to route my Seam application through an Apache virtual host and am running into problems with URL rewriting. I'm following these instructions for accomplishing the same task for Confluence:

      http://confluence.atlassian.com/display/DOC/Using+Apache+with+mod_proxy#UsingApachewithmod_proxy-Complexconfiguration

      I used the LiveHttpHeaders extension of Firefox to grab the interaction between the client and server.

      http://integration.drc-dev.ohiolink.edu/
      
      GET / HTTP/1.1
      Host: integration.drc-dev.ohiolink.edu
      User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
      Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
      Accept-Language: en-us,en;q=0.5
      Accept-Encoding: gzip,deflate
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      Keep-Alive: 600
      Proxy-Connection: keep-alive
      Pragma: no-cache
      Cache-Control: no-cache
      
      HTTP/1.x 302 Moved Temporarily
      Date: Wed, 31 Jan 2007 18:14:17 GMT
      Server: Apache-Coyote/1.1
      Location: http://integration.drc-dev.ohiolink.edu/drc/
      Content-Length: 0
      Content-Type: text/plain
      Connection: close
      
      ----------------------------------------------------------
      
      http://integration.drc-dev.ohiolink.edu/drc/
      
      GET /drc/ HTTP/1.1
      Host: integration.drc-dev.ohiolink.edu
      User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
      Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
      Accept-Language: en-us,en;q=0.5
      Accept-Encoding: gzip,deflate
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      Keep-Alive: 600
      Proxy-Connection: keep-alive
      Pragma: no-cache
      Cache-Control: no-cache
      
      HTTP/1.x 404 /drcdrc/
      Date: Wed, 31 Jan 2007 18:14:17 GMT
      Server: Apache-Coyote/1.1
      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
      Content-Length: 976
      Connection: close
      


      The essence of the HTML error message is:

      HTTP Status 404 - /drcdrc/
      
      type Status report
      message /drcdrc/
      description The requested resource (/drcdrc/) is not available.
      


      The VirtualHost definition in the Apache server is:

      <VirtualHost *:80>
       ServerName integration.drc-dev.ohiolink.edu
      
       ProxyRequests off
       ProxyPreserveHost On
      
       <Proxy *>
       Order deny,allow
       Allow from all
       </Proxy>
       ProxyPass / http://localhost:8080/drc
       ProxyPassReverse / http://localhost:8080/drc
       ProxyHTMLURLMap /drc/ /
      
       <Location />
       Order allow,deny
       Allow from all
       </Location>
      </VirtualHost>
      


      This configuration looks like it would work, and in the case of Confluence it seems likely it would work. I have a non-Seam applet running in the same JBoss with a similar Apache configuration and it works fine. The issue seems isolated to Seam, but I can't pin it down.

      Any advice?

        • 1. Re: Seam via Apache and ProxyPass/ProxyPassReverse not worki
          datagazetteer

          A follow-up -- I've tweaked the Apache configuration to the point where I can get the home page to load, but the next step in the application -- form submissions -- is not working. Here is the new Apache configuration (different from the first by adding some trailing slashes to some of the parameters):

          <VirtualHost *>
          ServerName integration.drc-dev.ohiolink.edu
           ProxyRequests off
           ProxyPreserveHost On
           <Proxy *>
           Order deny,allow
           Allow from all
           </Proxy>
           ProxyPass / http://localhost:8080/drc/
           ProxyPassReverse / http://localhost:8080/drc/
          
           SetOutputFilter proxy-html
           ProxyHTMLExtended on
           ProxyHTMLURLMap /drc/ /
          
           <Location />
           Order allow,deny
           Allow from all
           </Location>
          </VirtualHost>
          


          The HTML error is slightly different:

          HTTP Status 404 - /drc/drc/itemList.seam
          
          type Status report
          message /drc/drc/itemList.seam
          description The requested resource (/drc/drc/itemList.seam) is not available.
          


          ...as is the HTTP trace:

          http://integration.drc-dev.ohiolink.edu/home.seam;jsessionid=DB7F029598D3F83AC725FB1BE50A2C69
          
          POST /home.seam;jsessionid=DB7F029598D3F83AC725FB1BE50A2C69 HTTP/1.1
          Host: integration.drc-dev.ohiolink.edu
          User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
          Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
          Accept-Language: en-us,en;q=0.5
          Accept-Encoding: gzip,deflate
          Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
          Keep-Alive: 600
          Proxy-Connection: keep-alive
          Referer: http://integration.drc-dev.ohiolink.edu/home.seam
          Cookie: JSESSIONID=DB7F029598D3F83AC725FB1BE50A2C69
          Content-Type: application/x-www-form-urlencoded
          Content-Length: 10208
          [...form content...]
          
          HTTP/1.x 302 Moved Temporarily
          Date: Wed, 31 Jan 2007 19:23:29 GMT
          Server: Apache-Coyote/1.1
          X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5
          Location: http://integration.drc-dev.ohiolink.edu/drc/itemList.seam?cid=64
          Content-Length: 0
          Content-Type: text/plain
          Connection: close
          
          ----------------------------------------------------------
          
          http://integration.drc-dev.ohiolink.edu/drc/itemList.seam?cid=64
          
          GET /drc/itemList.seam?cid=64 HTTP/1.1
          Host: integration.drc-dev.ohiolink.edu
          User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
          Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
          Accept-Language: en-us,en;q=0.5
          Accept-Encoding: gzip,deflate
          Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
          Keep-Alive: 600
          Proxy-Connection: keep-alive
          Referer: http://integration.drc-dev.ohiolink.edu/home.seam
          Cookie: JSESSIONID=DB7F029598D3F83AC725FB1BE50A2C69
          
          HTTP/1.x 404 /drc/drc/itemList.seam
          Date: Wed, 31 Jan 2007 19:23:30 GMT
          Server: Apache-Coyote/1.1
          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
          


          It would seem that ProxyPassReverse isn't getting invoked for the Location header in reponse to the POST, except that I see it working with non-Seam applications.

          • 2. Re: Seam via Apache and ProxyPass/ProxyPassReverse not worki
            datagazetteer

            I found a way to work around this by adding additional ProxyPass and ProxyPassReverse lines. The source of the mysterious applet context path still remains, though, as the "/drc" path still shows up in the browser for Seam Facelet form only. This is quite strange and unexpected.

            <VirtualHost *:80>
             ServerName integration.drc-dev.ohiolink.edu
            
             ProxyRequests off
             ProxyPreserveHost On
            
             <Proxy *>
             Order deny,allow
             Allow from all
             </Proxy>
             ProxyPass /drc/ http://localhost:8080/drc
             ProxyPass / http://localhost:8080/drc
             ProxyPassReverse / http://localhost:8080/drc
             ProxyHTMLURLMap /drc/drc/ /
             ProxyHTMLURLMap /drc/ /
            
             <Location />
             Order allow,deny
             Allow from all
             </Location>
            </VirtualHost>
            


            Does this look like a bug or something that I'm doing wrong?

            • 3. Re: Seam via Apache and ProxyPass/ProxyPassReverse not worki
              shane.bryzak

              Can't you just use mod_jk?