Forum Discussion

Lucilius_223799's avatar
Lucilius_223799
Icon for Nimbostratus rankNimbostratus
Jul 19, 2016
Solved

redirect F5

Hello,

 

I had a question about redirecting on the F5. We have a VS with probably around 30+ redirects. Now we wish to redirect all the pages from the VS to a single maintenance page is this possible without removing any of the other URLS/redirects. Is there an easy way to redirect the pages? I'm used to using a contain/equals expression but that won't do in this case cause it involves websites without most of the regular name as well. So that would mean something more in the direction of a global redirect for anything on that virtual server.

 

Thank you in advance for all the help.

 

  • Hi,

     

    if you are using an irule to do redirects, you just need to add a peace of code on the top of the irule to redirect the user in every condition like this :

     

    when HTTP_REQUEST {
            HTTP::respond 302 Location "https:://www.example.com/" Connection Close
            return
    }

    You add those two lines at the top of the irule and all requests should be redirected to https://www.example.com. If you need to keep the original uri, you can change the redirect command by this one :

     

        HTTP::respond 302 Location "https:://www.example.com/[HTTP::uri]" Connection Close

    If you are using LTM policies, you can add a rule at the top of your rule set to redirect all requests to the desired host

     

    And finally, you can shutdown your assigned pool and add a fallback url in your http profile assigned to the Virtual Server.

     

16 Replies

  • Hi,

     

    if you are using an irule to do redirects, you just need to add a peace of code on the top of the irule to redirect the user in every condition like this :

     

    when HTTP_REQUEST {
            HTTP::respond 302 Location "https:://www.example.com/" Connection Close
            return
    }

    You add those two lines at the top of the irule and all requests should be redirected to https://www.example.com. If you need to keep the original uri, you can change the redirect command by this one :

     

        HTTP::respond 302 Location "https:://www.example.com/[HTTP::uri]" Connection Close

    If you are using LTM policies, you can add a rule at the top of your rule set to redirect all requests to the desired host

     

    And finally, you can shutdown your assigned pool and add a fallback url in your http profile assigned to the Virtual Server.

     

    • Lucilius_223799's avatar
      Lucilius_223799
      Icon for Nimbostratus rankNimbostratus

      Would that mean i have to change the redirect url on all 40+ redirects that are currently active or it is possible to setup some global redirect and temporarily remove all the other redirects and then bring them back from the standby later on?

       

    • Yann_Desmarest_'s avatar
      Yann_Desmarest_
      Icon for Nacreous rankNacreous

      Can you share an anomized example of your configuration ? Are you requesting to redirect traffic from all Virtual Servers or just one ?

       

      Do you have all redirects in an irule, ltm policy or something else ?

       

    • Lucilius_223799's avatar
      Lucilius_223799
      Icon for Nimbostratus rankNimbostratus

      most redirect exist along the lines of this:

          when HTTP_REQUEST {
        if { [HTTP::host] equals "xyz.com" }{
          HTTP::respond 301 location "http://www.abc.com"
        }
      
      }
      
  • Hi,

     

    if you are using an irule to do redirects, you just need to add a peace of code on the top of the irule to redirect the user in every condition like this :

     

    when HTTP_REQUEST {
            HTTP::respond 302 Location "https:://www.example.com/" Connection Close
            return
    }

    You add those two lines at the top of the irule and all requests should be redirected to https://www.example.com. If you need to keep the original uri, you can change the redirect command by this one :

     

        HTTP::respond 302 Location "https:://www.example.com/[HTTP::uri]" Connection Close

    If you are using LTM policies, you can add a rule at the top of your rule set to redirect all requests to the desired host

     

    And finally, you can shutdown your assigned pool and add a fallback url in your http profile assigned to the Virtual Server.

     

    • Lucilius_223799's avatar
      Lucilius_223799
      Icon for Nimbostratus rankNimbostratus

      Would that mean i have to change the redirect url on all 40+ redirects that are currently active or it is possible to setup some global redirect and temporarily remove all the other redirects and then bring them back from the standby later on?

       

    • Yann_Desmarest's avatar
      Yann_Desmarest
      Icon for Cirrus rankCirrus

      Can you share an anomized example of your configuration ? Are you requesting to redirect traffic from all Virtual Servers or just one ?

       

      Do you have all redirects in an irule, ltm policy or something else ?

       

    • Lucilius_223799's avatar
      Lucilius_223799
      Icon for Nimbostratus rankNimbostratus

      most redirect exist along the lines of this:

          when HTTP_REQUEST {
        if { [HTTP::host] equals "xyz.com" }{
          HTTP::respond 301 location "http://www.abc.com"
        }
      
      }