Forum Discussion

chocokoala's avatar
chocokoala
Icon for Altostratus rankAltostratus
May 31, 2022

iRule Recommendation

Hi,

I need help for an irule to be used for this scenario (this is a outlook/owa/autodiscover setup)

we currently have a setup/irule that if the client type webmail.abc.com/owa it goes to the owa pool, if webmail.abc.com/autodiscover it goes to autodiscover pool 

my question now, they want to change the domain that if the user types webmail.abc.com it redirect to webmail.xyz.com, if user type webmail.abc.com/owa redirect to webmail.xyz.com/owa same with /autodiscover

we used the iapp for exchange setup btw,, for this redirection is there a way we can do this? or is this simple redirection irule that redirect webmail.abc.com to webmail.xyz.com ?

  • A simple redirection irule should do the redirection :

    when HTTP_REQUEST { 
      if { [HTTP::host] eq "webmail.abc.com" } { 
        HTTP::redirect "https://webmail.xyz.com[HTTP::uri]"
      } 
    } 

     Then you old irule should take care of pool selection :

    when HTTP_REQUEST {
      if { [HTTP::uri] starts_with "/owa" } {
        pool OWA_pool
      } 
      elseif { [HTTP::uri] starts_with "/example" } {
        pool Example_pool
      }
      #...
    }

    If irules are associated to the same VS, yous should make sure the redirect execute first, you have a number of options for that including checking for the hostname before pool selection, or adding priorities to your events

    • chocokoala's avatar
      chocokoala
      Icon for Altostratus rankAltostratus

      Hi again,

      For the 2nd line:
      if { [HTTP::host] eq "webmail.abc.com" }

      don't i need to add [HTTP::uri] ?

      sorry im just newbie on f5 irules