Forum Discussion

Diago1111's avatar
Diago1111
Icon for Altocumulus rankAltocumulus
Jul 10, 2023
Solved

url redirect

Hi  there,

We have a requirement in which we alredy have existing virtual server with pool members associated with it used to server http/https requests to some uri. Those Pool members are hosted in Data Center.

Issue:: client has migrated few of the content of those servers to cloud.but users are still accessing those content with old url path. 

Requirement:: We are required to provide solution in which if client access to those contect with old url it should be checked by redirect APP if those contents are available in database and that redirect APP will perform decision and based on decision it should be either forwarded to data center hosted servers or through cloud.

I need help here as how can we achieve this scenario. We should not be chaging any existing  F5 configuration to achieve the solution that is client requirement. Below is traffic flow diagram to understand the requirement.

 

 

 

 

  • Paulius's avatar
    Paulius
    Jul 10, 2023

    Diago1111 I have come up with the following iRule which should do what you want. I have swapped "xyz" with "example.com" so in your scenario the redirect app pool server would send a redirect back to the client of "redirect.example.com" instead of "xyz-redirect" so that it appears as a full FQDN rather than a partial name. You can replace "example.com" with whatever you would like and the same goes for the URI path that you would like to match. Please keep in mind that this iRule assumes that the default pool associated to your virtual server would be the iflow server pool but if it isn't you would need to add an else action to send all other traffic to your iflow server pool.

     

    when HTTP_REQUEST priority 500 {
    
        if { ([HTTP::host] == "example.com") && ([string tolower [HTTP::uri]] contains "/iflow/cx.exe/link") } {
            pool POOL_redirect_app
        }
    
    }

     

  • Thanks Paulius  I will test this.. return traffic from redirect app will go through F5 to client or it will send redirect url to client bypassinf F5? I assume this will go through F5...

  • Paulius's avatar
    Paulius
    Jul 11, 2023

    Diago1111 As long as the F5 is in path or you have SNAT enabled on the virtual server the response will go back through the F5 and to the client.

7 Replies

  • Diago1111 You might be able to accomplish this with a string map but without know a bit more I can't say definitevly that that would be the correct solution for you. That redirect app seems like it should take care of the destination to the cloud and all other redirects if it knows about everything but if not then a string map might be the next best bet.

    • Diago1111's avatar
      Diago1111
      Icon for Altocumulus rankAltocumulus

      Hi Paulius 

      Below is traffic flow for Data center server:

      •User click on the inflo link pattern https://xyz/iflow/cx.exe/link/xxxxxx

      •F5 irule matches https://xyz/iflow/cx.exe/link” and forward the request to redirect app server pool.

      •Redirect-App check whether the document is in cloud or in iflow. If the document is in iflow the redirect app will send back redirected  URL  https://xyz-redirect/iflow/cx.exe/link/xxxxxx to F5 and F5 will forward it client.

      •Client send redirected URL https://xyz-redirect/iflow/cx.exe/link/xxxxxx to F5 . New DNS entry should be created to point xyz-redirect to F5 iflow VIP IP.  F5 find it is not matching irule so forward directly to iflow server pool and iflow app respond to user with the page

      Below is traffic flow for cloud:

      •User click on the inflo link pattern https://xyz/iflow/cx.exe/link/xxxxxx

      •F5 irule matches https://xyz/iflow/cx.exe/link” and forward the request to redirect app server pool.

      •Redirect-App check whether the document is in cloud or in iflow. If the document is in cloud the app will send back redirected  URL  {{cloud url}} to F5 and F5 will forward it client.

      •Client send traffic to cloud.

      • Paulius's avatar
        Paulius
        Icon for MVP rankMVP

        Diago1111 I have come up with the following iRule which should do what you want. I have swapped "xyz" with "example.com" so in your scenario the redirect app pool server would send a redirect back to the client of "redirect.example.com" instead of "xyz-redirect" so that it appears as a full FQDN rather than a partial name. You can replace "example.com" with whatever you would like and the same goes for the URI path that you would like to match. Please keep in mind that this iRule assumes that the default pool associated to your virtual server would be the iflow server pool but if it isn't you would need to add an else action to send all other traffic to your iflow server pool.

         

        when HTTP_REQUEST priority 500 {
        
            if { ([HTTP::host] == "example.com") && ([string tolower [HTTP::uri]] contains "/iflow/cx.exe/link") } {
                pool POOL_redirect_app
            }
        
        }