Forum Discussion

saddiq_bilal's avatar
saddiq_bilal
Icon for Nimbostratus rankNimbostratus
Mar 18, 2025
Solved

Application only need to access from 2 uris

Hei,

We have some issues going and need to restrict the access only to 3 uri from any ips. I tried it via host irules, but its not working. Anyone please help in the same?

 

Thanks

Bilal

  • Hello saddiq_bilal 

     

    Try this - 

     

    when HTTP_REQUEST {

        if { ([HTTP::uri] == "/uri1") } {

            # Do nothing, meaning permit request

            } elseif { ([HTTP::uri] == "uri2") } {

            # Do nothing, meaning permit request  

        } elseif { ([HTTP::uri] == "any other uris") } {

            # Do nothing, meaning permit request  

        } else {

            # If the uri does not contain any of the previously matching values then reject the request

        reject

        }

    }

     

3 Replies

  • Hello saddiq_bilal 

     

    Try this - 

     

    when HTTP_REQUEST {

        if { ([HTTP::uri] == "/uri1") } {

            # Do nothing, meaning permit request

            } elseif { ([HTTP::uri] == "uri2") } {

            # Do nothing, meaning permit request  

        } elseif { ([HTTP::uri] == "any other uris") } {

            # Do nothing, meaning permit request  

        } else {

            # If the uri does not contain any of the previously matching values then reject the request

        reject

        }

    }

     

  • use local traffic policy rather than irules for better performance and to prevent typo

     

  • did you try something like this?

    when HTTP_REQUEST {
        if { ([HTTP::uri] starts_with "/uri-1" } || ([HTTP::uri] starts_with "/uri-2" } )
        {
        }
        else
        {
            drop
        }
    }