Forum Discussion

Brett__01_13258's avatar
Brett__01_13258
Icon for Nimbostratus rankNimbostratus
Oct 14, 2013

irule redirect and masking

Hi Im having trouble with an irule I hope you can help.

 

Im trying to have request that goes to host with /external* redirects to another site but the rul is masked with original request

 

A request to https://Mainsiteurl.site.com.au/extranet/folder/folder/aphandbook.htm should go to http://extranet.site.com.au/folder/folder/aphandbook.htm . In the browser however it will show as original request https://Mainsiteurl.site.com.au/extranet/folder/folder/aphandbook.htm

 

Is this possible? and if so could someone help with the rule

 

I have got but dont have a sandbox environment to test on

 

"/extranet*" { SSL::disable serverside

 

HTTP::uri "/[string range $uri 9 end]" log local0. " extranet $uri" HTTP::header replace "Host" "extranet.site.com.au" }

 

3 Replies

  • OK redirection is working fine now just need to keep the original URL. any thoughts would be appreciated? thanks

    when HTTP_REQUEST {

    if {[string tolower [HTTP::uri]] starts_with "/extranet"}{
    

    set new_uri [string map {"/extranet" ""} [HTTP::uri]] HTTP::redirect "http://extranet.site.com.au$new_uri" } }

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Brett,

     

    How about changing your 2nd example so once you've set the new_uri do a replace header and then change ur. Something like:

     

    HTTP::header replace "Host" "extranet.site.com.au"

     

    HTTP:: uri "/$new_uri"

     

    Might that work?

     

  • A redirect to "http://extranet.site.com.au" will cause the browser to show that address. If you want to keep the browser on "https://Mainsiteurl.site.com.au", then your first iRule code was probably more appropriate. That is, instead of physically redirecting the user to another host, you must send the traffic through the Mainsite VIP.

     

    when HTTP_REQUEST {
        if { [string tolower [HTTP::uri]] starts_with "/extranet" } {
            HTTP::uri "/[string range [HTTP::uri] 9 end]"
            HTTP::header replace Host "extranet.site.com.au"
            pool extranet_pool
            SSL::disable serverside
        }
    } 

    The above assumes that the Extranet service is in a different pool of servers than your regular traffic, and that your regular pool of servers are listening on SSL.