BIGIP F5 iRule — Block URI for external Client’s only

So, I had a cool question asked to me today regarding an F5 VIP used by a web application.
“Can we block a certain URI from external client’s but allow internal client’s to visit it?”

Of course there is!! Now there are probably a billion different ways to do this, but this is what I came up with. First the condition, we want only 10.0.0.0/8 hosts to be able to access this restricted URI. Anyone else should be dropped. I say dropped and not denied, because that way if a user tries to navigate to the URI that shouldn’t it just timesout, and doesn’t give them any more information then they need. Second, I want to log blocks, so I can see it working and get an idea of how many times it gets hit. Lastly we need to know the Virtual server to apply the iRule to.

Here is the finished iRule, hope it helps!

 


NOTICE: The above rule can be reworked to be more granular, and also more specific with the source IP’s of the client. If you need to list multiple host IPs that cannot be easily summarized like above, consider using data groups on the F5. These are like arrays where you can feed it multiple data points, and the iRule will look through it when it performs the condition check.

Leave a Reply