Forum Discussion

ShankarA_326137's avatar
ShankarA_326137
Icon for Nimbostratus rankNimbostratus
Jul 23, 2017

f5 rule needed for proxy_pass and proxy_redirect

Hello Team,

 

I am new to F5. I need help on F5 rules for my requirement. I was able to accomplish the same using nginx.

 

I'm specifically looking at irules for location / and location /synchrony. There are two services running on the same server one is on 8090 and another on 8091. If the incoming HTTP request contains /synchrony then it should proxy redirect them to same server on port 8091 and everything else should go to the same backend server on port 8090.

 

Currently, I setup vserver and accessing wiki.mydomain.com is going to backend on port 8090 (http://172.16.222.161:8090).

 

Please see attached screenshot for nginx configuration. For some reason, I can't add that info here.

 

Please suggest.

 

Thanks Shankar

 

  • I have the following iRULE and it works partially. Two pools inside VS (synpool - 172.16.222.161:8091 and confpool - 172.16.222.161:8090). and the rule is,

     

    when HTTP_REQUEST { if { [HTTP::uri] contains "/synchrony" and [TCP::local_port] == 80 } { pool synpool } else { pool confpool } }

     

    Pls let me know if the above rule is correct. Any other suggestions / advice ?

     

    Thanks Shankar

     

  • Hello Shankar,

    I think your rule is almost good but you don't need to check port number and you can add a "string tolower" in order to lower case character for the comparison.

    Use the following instead :

    when HTTP_REQUEST {
        if { [string tolower [HTTP::uri]] contains "/synchrony" } {
            pool synpool
        } else { 
            pool confpool 
        }
    }
    

    Hope it helps