For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Pav_70755's avatar
Pav_70755
Icon for Nimbostratus rankNimbostratus
Oct 26, 2010

HTTP Re-Direct and keep original URL in address bar

I have the following simple re-direct in place


}
elseif { [HTTP::host] == "www.domain.com  }{
       HTTP::redirect "http://www.abc.com/subject"

I basically want the address bar to keep www.domain.com when displaying www.abc.com/subject

Any help much appreciated.

Thanks

Pav

14 Replies

  • Hi Aaron,

    The re-direct I rule I have set up is as follows

    Un-comment the following lines if the site uses SSL 
      
     when CLIENT_ACCEPTED { 
                 TCP::collect 5 
             }                
      
     when CLIENT_DATA { 
             if { [matchclass [TCP::payload] starts_with $::http_methods] } { 
                 SSL::disable 
             } 
     } 
     when HTTP_REQUEST { 
             if { [TCP::local_port] eq "80"  } { 
                 persist source_addr 1800 
                 HTTP::fallback http://support.abc.com/ 
      Un-comment the next 3 lines for redirects and expand out with elseif's if needed  
         if { [HTTP::host] == "www.abc1.com" } { 
                     HTTP::redirect "http://url1.com" 
     } 
                 elseif { [HTTP::host] == "www.abc2.com" } { 
                     HTTP::redirect "http://host2.com" 
     } 
                 elseif { [HTTP::host] == "www.domain3.com" } { 
                     HTTP::redirect "http://www.url4.com" 
      } else { 
                 pool Web_Farm_Front  
      Un-comment the net line if using redirects             
                } 
             }   elseif { [TCP::local_port] eq "443"  } { 
                 HTTP::header insert "BPL-SSL" "On" 
                 pool Web_Farm_Front 
             } else { 
             set srvr [findclass [TCP::local_port] $::Individual_Servers " "] 
             if { $srvr ne "" } { 
                node $srvr 80 
             }  else { 
           } 
        }   
     } 
     }

    So do I need to set up a separate pool to use for the header re-write rule?

    Thanks

    Pav
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Pav,

     

     

    If all of the servers in the single pool answer for both host names you don't need separate pools.

     

     

    Aaron
  • HI Aaron yep thats right although the rule doesnt appear to be working as im getting the invalid hostname error.

     

     

    Do you have any other ideas or rules I could use?

     

     

    Thanks again for all your help.
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Pav,

     

     

    I'd still suggest looking at these questions to figure out what you need to do on LTM to get this to work:

     

     

    Do all servers in the pool have the same host header set in the web server virtual host definition? Is that what you've put in the iRule in replacement of www.abc.com?

     

     

    Put another way, if you make a request directly to the pool members, what host name(s) do you have to use to get a valid response from the server?

     

     

    Aaron