1 Reply Latest reply: Feb 16, 2013 7:35 AM by Peter.Lorenzen RSS

    Retain Orginal URL after Reverse Proxying

    991455
      I am trying to do a reverse proxy using Apache config file (Apache 2.2)

      I am able to successfully reverse proxy a user from https://www4.dev.sonet.se/chatview/ to http://pkma-usis.kaddi.sonet.fe/chatview

      But when i try to retain the host domain name after reverse proxy using "Header edit Location" directive, it fails.

      i.e, After redirection to http://pkma-usis.kaddi.sonet.fe:80/chatview the user must see the URL as https://www4.dev.sonet.se/chatview.

      I wanted to know if what I am trying to do is feasible in the first place and if this is a good practice. Following is my config file.

      Can anyone please help me in this? - if I am using a correct approach? any alternate options available? debugging options to find out where my config goes wrong ?

      #######################

      <Macro SingleNode %h1 %lp %rp>

      <Location /%lp/>
      Header add Set-Cookie "%Chat_SID=h.%{BALANCER_WORKER_ROUTE}e;\
      path=/%lp/;" env=BALANCER_ROUTE_CHANGED
      Header edit Location "^(.*pkma-usis.kaddi.sonet.fe.*/%lp/)(.*)$" "/%lp/$2"
      </Location>

      <Proxy balancer://%lpCluster>
      BalancerMember http://%h1 min=1 smax=3 max=10 ttl=10 route=%h1
      </Proxy>

      ProxyPassReverse /%lp/ http://%h1/%rp/
      RewriteRule ^/%lp/(.*) balancer://%lpCluster/%rp/$1 [proxy]
      ProxySet balancer://%lpCluster stickysession=%Chat_SID

      </Macro>


      <IfDefine DEV>
      Use SingleNode jemma-uusi.stadi.sonera.fi:80 chatview chatview
      </IfDefine>


      <LocationMatch "/chatview/">
      AuthType Basic
      Require valid-user
      AuthName CT
      </LocationMatch>

      ###################################
        • 1. Re: Retain Orginal URL after Reverse Proxying
          Peter.Lorenzen
          Hi,

          I am not sure I 100% understand you setup but it is possible to retain the URL after a proxy :-)

          Here is a edited example from one of our customers:

          1. httpd.conf
          <VirtualHost 172.30.123.10:80>
            ServerName theheat.dk
            RewriteEngine On
            RewriteCond %{HTTPS} off
            RewriteRule ^(.*)$ https://theheat.dk$1
          </VirtualHost>
          2. ssl.conf
          <VirtualHost 172.30.123.10:443>
          
          ServerName theheat.dk
          
          RewriteEngine On
          RewriteRule ^/$ /example/faces/Home [R=301]
          
          RequestHeader set WL-Proxy-SSL true
          
          ProxyPass        /example/ http://wintermute:8001/example/
          ProxyPassReverse /example/ http://wintermute:8001/example/
          3. Admin Console
          In the Admin Console navigate to the Managed Server running on port 8001 and find Configuration => General => Advanced.
          Put a check mark in "WebLogic Plug-In Enabled" even though your are not using the mod_wl plug-in.

          Now select the Protocols tab and then HTTP. Set "Frontend Host" to theheat.dk and for "Frontend HTTPS Port" input 443.

          Hope it helps.

          Regards Peter