Forum Discussion

Anthony_Fornito's avatar
Nov 20, 2017

Redirect based off URL not URI

I have 3 nodes setup

In IIS on each server I have a binding:

https://node1.domain.com/

https://node2.domain.com/

https://node3.domain.com/

My nodes:

Node1192.168.70.57

Node2192.168.70.58

Node3192.168.70.88

I am looking for an irule that if the url contains node1 it will go to node 1

for example:

uses goes to node1.domain.com

the will get redirected (redirected may be the wrong word here) to https://node1.domain.com

the Page on node 1 will come up.

Here is what I have tired but I keep getting a 404 though the f5, if i set my host file for node 1 it works fine.

when HTTP_REQUEST {
  if { [string tolower [HTTP::uri] ] contains "*node1*" } {
    node 192.168.70.57 443
  }
}

3 Replies

  • Can you post the virtual server configuration?

     

    You must have a clientssl and serverssl there.

     

  • The URL is a client side view. the F5 never see the whole URL in the request but :

    • URI
    • Host header
    • other headers

    I guess you want to filter based on the Host header, so try this:

    when HTTP_REQUEST {
      if { [string tolower [HTTP::host] ] contains "node1" } {
        node 192.168.70.57 443
      }
    }
    
  • Ok i got it to work

    when HTTP_REQUEST {
      if { [string tolower [HTTP::uri] ] contains "/?node=6" } {
        HTTP::header replace "Host" "dev_portal.paymentvision.com"
        HTTP::path "/"
        node 192.168.70.88 443
      }
    }