For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Azerturkbank's avatar
Azerturkbank
Icon for Nimbostratus rankNimbostratus
Sep 24, 2019

Single Virtual IP, single pool, 2 members

Hello friends.

I have configured Reverse proxy that single pool with the two pool members is behind the single Virtual Server.

VIP:10.200.17.10:443 -------->Pool1: Members: 10.200.5.10:7007 AND 10.200.5.10:7005

There are diverse domain name for each service.

10.200.5.10:7007 ----> cg.company.local and

10.200.5.10:7005 sg.company.local

irules configuration is below:

when HTTP_REQUEST {

 if { [string tolower [HTTP::host]] eq "cg.company.local" and [HTTP::path] ne "/SVFE2/" and [HTTP::path] eq "/" } {

   HTTP::respond 302 Location "https://[HTTP::host]/SVFE2/"

 }

 elseif { [string tolower [HTTP::host]] eq "sg.company.local" and [HTTP::path] ne "/sv/" and [HTTP::path] eq "/" } {

   HTTP::respond 302 Location "https://[HTTP::host]/sv/"

 }

}

But I encounter with the errors. Sometimes sites don`t not open.

I deem it is related to load balancing behavior of F5.

Could you give me a hand to find a solution?

9 Replies

  • Hi,

    can you try this:

    when HTTP_REQUEST {
    if { [string tolower [HTTP::host]] == "cg.company.local" && [HTTP::uri] == "/" } {
    	HTTP::redirect "https://[HTTP::host]/SVFE2/"
    }
    elseif { [string tolower [HTTP::host]] == "sg.company.local" && [HTTP::uri] == "/" } {
    	HTTP::redirect "https://[HTTP::host]/sv/"
    }
    }

    Regards

  • I tried this, but did not work.

    The first cg.company.local works, but sometimes it gets errors, I suppose it redirect to 7005 instead of 7007 service port. Second one did not work at all.

  • I did with node, but this time redirection did not work.

    when HTTP_REQUEST {

     if { [string tolower [HTTP::host]] starts_with "cg.company.local"} {

        node "10.200.5.14:7007"

         }

       elseif { [string tolower [HTTP::host]] starts_with "sg.company.local" } {

       node "10.200.5.14:7005"

     }

     }

    If I write full link https://[HTTP::host]/SVFE2/ , it works.

    But when I write only cg.company.local, it does not as it is not forwarded.

     

  • I fixed problem.

    when HTTP_REQUEST {

     if { [string tolower [HTTP::host]] eq "cg.company.local" and [HTTP::path] ne "/SVFE2/" and [HTTP::path] eq "/" } {

       HTTP::respond 301 Location "https://cg.company.local/SVFE2/"

       node "10.200.5.14:7007"

         }

      elseif { [string tolower [HTTP::host]] eq "sg.company.local" and [HTTP::path] ne "/sv/" and [HTTP::path] eq "/" } {

       HTTP::respond 301 Location "https://sg.company.local/sv/"

       node "10.200.5.14:7005"

     }

     }

    • Enes_Afsin_Al's avatar
      Enes_Afsin_Al
      Icon for MVP rankMVP

      Hi,

      "Node command" works if uri equals "/", for your rule.

      Use this iRule if you want to redirect all hostname based requests to node.

      when HTTP_REQUEST {
      	if { [string tolower [HTTP::host]] equals "cg.company.local" } {
      		if { [HTTP::uri] equals "/" } { 
      			HTTP::respond 301 Location "https://[HTTP::host]/SVFE2/"
      		}
      		node "10.200.5.14:7007"
      	}
      	elseif { [string tolower [HTTP::host]] equals "sg.company.local" } {
      		if { [HTTP::uri] equals "/" } { 
      			HTTP::respond 301 Location "https://[HTTP::host]/sv/"
      		}
      		node "10.200.5.14:7005"
      	}
      }