Forum Discussion

JOBrien2019's avatar
JOBrien2019
Icon for Nimbostratus rankNimbostratus
Apr 15, 2019

iRule using IP

I want to setup an iRule to redirect on an IP which has a swagger page. Here's what I have:

when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
    "**My ip address here**" {
      if { [HTTP::uri] starts_with "swagger" } {HTTP::redirect "https://[HTTP::host]/"}
      if { [HTTP::uri] starts_with "api" } {HTTP::redirect "https://[HTTP::host]/"}
    }
}

}

By this guide it looks correct but it doesn't actually redirect a page.

1 Reply

  • A URI path always starts with a forward-slash, so change "swagger" to "/swagger" and "api" to "/api", and you should be all right.