Forum Discussion

sberhorst_30626's avatar
sberhorst_30626
Icon for Nimbostratus rankNimbostratus
Jan 13, 2017

URL Redirect help needed in iRule with path forwarding

Hi,

 

I'm trying to do a redirect from a DNS name to a web URL. As an example I want to type in home.example.com to redirect to https://apps.google.com/user/hub using the F5 iRules.

 

I've tried the following but get a syntax error:

 

when HTTP_REQUEST { if {[HTTP::host] eq “home.example.com”}{

 

Send 302 redirect to the new location

HTTP::redirect https://apps.google.com/user/hub } }

 

4 Replies

  • Here is the error response:

     

    01070151:3: Rule [/Common/Home_Redirect] error: /Common/Home_Redirect:2: error: [parse error: PARSE syntax 40 {syntax error in expression "[HTTP::host] eq “home.exmaple.com”": unexpected operator &}][{[HTTP::host] eq “home.example.com”}]

     

  • Edited the previous iRule:

    when HTTP_REQUEST { 
    if { [HTTP::host] eq "home.example.com" } { 
    HTTP::redirect "https://apps.google.com/user/hub"
    } 
    }