Forum Discussion

omprakashnm_321's avatar
omprakashnm_321
Icon for Nimbostratus rankNimbostratus
May 23, 2017

F5 redirect and change URL

I was reading thru the previously asked questions related to our scenario, and have tried but fails.

In Our environment, we have an URL http://1n2m.n2m.com/eds/getInfo with method POST. The URL needs to route to another pool with changing HOST and URI. The new URL will be http://2n2m.n2m.com/InfoDetails

I have tried as below, but did not work

   if { ( [HTTP::host] equals "1n2m.n2m.com:443") || ([HTTP::host] equals "1n2m.n2m.com") }
      {
            Check URI with wildcard matching
           if { [ HTTP::path ] contains "/eds/" }
             {
                node 10.17.69.11
                HTTP::header replace Host "https://2n2m.n2m.com" 
                HTTP::uri "/InfoDetails/v1/" 
                HTTP::redirect "https://2n2m.n2m.com/InfoDetails/v1/"
                pool mule_test_pool_01
             }
          else
             {
                pool legacy_pool_01
              }
    }
    else
    {
      log local0.info "Invalid [HTTP::host] [HTTP::path]"
      reject
    }

Problem we have is, as i have added redirect, the URL switch is noticed.

We do not want the URL to change for the enduser. If i do not add the redirect line, it does not work.

Any suggestion on how to correct it?

3 Replies