Forum Discussion

sundogbrew's avatar
sundogbrew
Icon for Altocumulus rankAltocumulus
Aug 28, 2019
Solved

Irule to redirect based on both IP and URI else default

Hey folks, I am trying to write an Irule that redirects based on IP & URI. So I want to say if you are coming from this IP 1.1.1.1 and your URI contains /notcool then redirect to a URL, otherwise j...
  • atoth's avatar
    Aug 28, 2019

    Sorry, try this. Couldn't quite remember where to put the parentheses.

     

    when HTTP_REQUEST {

    if { ([HTTP::uri] starts_with "/notcool") && ([IP::client_addr] equals "1.1.1.1")} {

    HTTP::redirect "https://coolnewpage.com/supercool"

    }

    else

    {

    pool notcool_pool

    }

    }

    }