Forum Discussion

Sams_88783's avatar
Sams_88783
Icon for Nimbostratus rankNimbostratus
Aug 26, 2010

Help with version 4.x irule

Hello,

 

 

I have 2 urls

 

https://mydomain/baa/init.do

 

https://mydomain/admin/init.do

 

 

And one pool mydomain.

 

 

My requirement is from a single soure 10.2.2.4 only allow access to url rest all has to go to or discard.

 

 

The Big-IP OS is running 4.5.11

 

 

I tried with the following statement

 

 

if(client_addr == 10.2.2.4)

 

{redirect to "" + "/admin" + "/init.do" + http_uri}

 

else {use pool mydomain}

 

if(client_addr!= 10.2.2.4)

 

{redirect to "" + "/baa" + "/init.do" + http_uri}

 

{use pool mydomain}

 

else {discard}

 

}

 

 

But its not working.

 

This is really urgent for me please help.

2 Replies

  • The logic in the iRule doesn't make sense to me. If client_addr equals "10.2.2.4" redirect, else use pool. Then you do a not test on the client_addr which would be the same case as the previous else. You then have an extra "{use pool mydomain}" before the else.

    This is a shot in the dark, but this might do what you want

    if (client_addr == 10.2.2.4)
    { redirect to "https://mydomain/admin/init.do" + http_uri }
    else
    { redirect to "https://mydomain/baa/init.do" + http_uri }

    If you define the default pool to "mydomain" this should work for you. I'm still unclear how the "discard" fits in. What case would you want that applied since you are only comparing on source ip and that is either equals or not equals.

    If you can provide a more detailed logic flow for how you want it to work, I could try to expand a bit further on this.

    -Joe