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

Nyam_220167's avatar
Nyam_220167
Icon for Nimbostratus rankNimbostratus
Aug 19, 2016

Traffic policy for url redirection creating Loops

Hello All, I am trying to do the url redirect as below and i have created a Traffic policy(https://support.f5.com/kb/en-us/solutions/public/14000/900/sol14996.html) for the same.URL is redirecting but it is looping. Could you please help me to diagnose the issue?

 

something.com -> google.com (1.1.1.1) We now need rules on the F5 Load Balancer to redirect as follows: http://something.com -> https://google.com/web/sei https://something.com -> https://google.com/web/sei http://something.com/* -> https://google.com/*

 

5 Replies

  • URl is looping? Can you please explain? In some cases I have seen the issue at server side, so you can use below irule:

     

    when HTTP_REQUEST { if{[HTTP::host] equals "something.com"} HTTP::redirect "https://google.com[HTTP::uri]" } else { return } }

     

  • HTTPS traffic: https://something.com -> https://google.com/web/sei

    when HTTP_REQUEST {
    if { ([HTTP::host] eq "something.com") and ([HTTP::uri] eq "/") } {
    HTTP::respond 301 Location "https://google.com/web/sei"
    }
    }
    

    You are probably not matching on "/" in the [HTTP::uri]. This is for HTTP traffic:

    when HTTP_REQUEST {
    if { ([HTTP::host] eq "something.com") } {
      if { [HTTP::uri] eq "/" } {
         HTTP::respond 301 Location "https://google.com/web/sei"
         } else {
         HTTP::respond 301 Location "https://google.com[HTTP::uri]"
         }
       }
    }
    
  • Hello Odaah, Tq for your quick reply. out of the 3 rules 2 of them are working.

     

    But below rule is not working. Can you please help me to fix this?

     

    1a. http://www.something.com -> https://www.google.com/web/something - not working yet 1b. https://www.something.com -> https://www.google.com/web/something - not working yet

     

    • Vijay_E's avatar
      Vijay_E
      Icon for Cirrus rankCirrus

      Can you provide the iRule that you are using and that is not working at the moment ?

       

  • when HTTP_REQUEST { if { ([HTTP::host] contains "something") } { if { [HTTP::uri] contains "/*" } { HTTP::respond 301 Location "https://www.google.com/web/xxx" } else { HTTP::respond 301 Location "https://www.google.com[HTTP::uri]" } } }