Forum Discussion

khoutman_235081's avatar
khoutman_235081
Icon for Nimbostratus rankNimbostratus
Nov 23, 2015

Re-direct irule but keep URL

Hello i'm trying to setup an irule to re-direct based on URI while keeping the original URL in the user's browser. Example- user goes to https://abc.com and clicks on a link that takes him to https://abc.com/xyz. I want to redirect the user to https://def.abc.com/xyz while keeping https://abc.com/xyz in the user's browser.

 

I've achieved the re-direct a couple of different ways but can't figure out how to keep the original URL in the user's browser. Here was my last attempt while trying a 301 response. Keep in mind i'm very new working with Irules!

 

when HTTP_REQUEST { if {[HTTP::uri] starts_with "/xyz" } { HTTP::respond 301 noserver Location "https://def.com/xyz" } }

 

6 Replies

  • This should do what you want.

    when HTTP_REQUEST {
        if { [string tolower [HTTP::path]] starts_with "/xyz" }{
            HTTP::respond 301 noserver Location "https://def.com[HTTP::uri]"
        }
    }
    
    • khoutman_235081's avatar
      khoutman_235081
      Icon for Nimbostratus rankNimbostratus
      Entered it in and it looks like chrome gives this error- ERR_EMPTY_RESPONSE and firefox gives this- The connection was reset. Any other thoughts?
    • Brad_Parker_139's avatar
      Brad_Parker_139
      Icon for Nacreous rankNacreous
      This will require an HTTP profile. And if the vip is HTTPS, that means you will also require a client SSL profile.
  • This should do what you want.

    when HTTP_REQUEST {
        if { [string tolower [HTTP::path]] starts_with "/xyz" }{
            HTTP::respond 301 noserver Location "https://def.com[HTTP::uri]"
        }
    }
    
    • khoutman_235081's avatar
      khoutman_235081
      Icon for Nimbostratus rankNimbostratus
      Entered it in and it looks like chrome gives this error- ERR_EMPTY_RESPONSE and firefox gives this- The connection was reset. Any other thoughts?
    • Brad_Parker's avatar
      Brad_Parker
      Icon for Cirrus rankCirrus
      This will require an HTTP profile. And if the vip is HTTPS, that means you will also require a client SSL profile.