3 Replies Latest reply on Nov 6, 2007 6:38 AM by je le

    jbossportal with apache proxy help ! (accessing portal from

    je le Newbie

      let's say I created 2 portals s1 and s2 ; I can perfectly access them with :
      http://xxx/portal/portal/s1 and http://xxx/portal/portal/s2

      for exemple i want to access them throught s1.org and s2.org. since apache will keep the 80 port (and jboss 8080), i'm trying apache proxy (mod_jk didn't work well...)

      i'm getting the site bit :
      1) no css, picture, etc...
      2) if i click a link (ex page2) instead of s1.org/page2 i'm getting http://s1.org/portal/portal/s1/page2, which fail to resolve...

      i hardly believe i'm the only one trying to acces portal instance from plain url, but i can't found any documentation ; it is so trivial !???

      nota : working on 127.0.0.1, with in /etc/hosts :
      127.0.0.1 s1.org
      127.0.0.1 s2.org

      my config apache :

      <virtualhost 127.0.0.1>
      ServerName s1.org
      ServerAlias www.s1.org

      ProxyRequests Off

      <Proxy *>
      Order deny,allow
      Allow from all


      ProxyPass / http://127.0.0.1:8080/portal/portal/s1/
      proxyPassReverse / http://127.0.0.1:8080/portal/portal/s1/
      SetOutputFilter proxy-html
      ProxyHTMLURLMap http://127.0.0.1:8080/portal/portal/s1 /

      ProxyPreserveHost Off




      Thks !!

        • 1. Re: jbossportal with apache proxy help ! (accessing portal f
          Burkhard Vogt Newbie

          I would recommend to use mod_rewrite in conjunction with mod_proxy, which provide more flexibility for integration of content in the namespace of the virtual host. In order to reduce maintenance effort should think about using include files like in the example below.

          Do you really need to use proxy-html?

          http.conf:

          ...
          ServerTokens Prod
          ...
          LoadModule rewrite_module modules/mod_rewrite.so
          LoadModule proxy_module modules/mod_proxy.so
          ...
          RewriteEngine on
          RewriteCond %{REQUEST_METHOD} ^(TRACE|LOCK|UNLOCK)
          RewriteRule .* - [F]
          ...
          
          <virtualhost 127.0.0.1>
           ServerName s1.org
          ...
           Include conf/s1.txt
          </virtualhost>
          
          <virtualhost 127.0.0.1>
           ServerName s2.org
          ...
           Include conf/s2.txt
          </virtualhost>
          


          s1.txt:
          RewriteRule .* - [E=DEFAULT_PORTAL:s1]
          RewriteRule .* - [E=DEFAULT_PAGE:p1]
          
          Include conf/common_rules.txt
          


          s2.txt:
          RewriteRule .* - [E=DEFAULT_PORTAL:s2]
          RewriteRule .* - [E=DEFAULT_PAGE:p2]
          
          Include conf/common_rules.txt
          


          common_rules.txt:
          RewriteCond %{REQUEST_URI} ^/$
          RewriteRule .* http://localhost:8080/portal/portal/%{ENV:DEFAULT_PORTAL}/%{ENV:DEFAULT_PAGE} [P]
          RewriteCond %{REQUEST_URI} ^$
          RewriteRule .* http://localhost:8080/portal/portal/%{ENV:DEFAULT_PORTAL}/%{ENV:DEFAULT_PAGE} [P]
          
          RewriteCond %{REQUEST_URI} ^/portal
          RewriteRule ^/(.*)$ http://localhost:8080/$1 [P]
          
          


          • 2. Re: jbossportal with apache proxy help ! (accessing portal f
            je le Newbie

            Thanks for your reply, it helps a lot; in a matter of fact it's the direction i were just looking at.

            btw it seem you have to add "RewriteEngine on" in each virtualhost directive, even if set in http.conf ; else rewrite doesn't process.

            second mistake of me was to remove proxy_http (instead of http_html which is no use anymore)... so if [P] directive doesn't work, check your config !

            Your code work perfectly "out of the box" ; definitively something to add in the jbossportal faq/doc

            THKS

            • 3. Re: jbossportal with apache proxy help ! (accessing portal f
              je le Newbie

              last word : in your apache vhost directive, don't forget :

              ProxyPreserveHost On

              else, when login into the portal you will fall into localhost:8080 url...

              A+