Forum Discussion
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?
- youssef1
Cumulonimbus
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
- Azerturkbank
Nimbostratus
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.
- Azerturkbank
Nimbostratus
is there any way to choose pool member based on service port?
Hi Azerturkbank,
You can use node command.
node <addr> [<port>] node <addr>:<port>
- Azerturkbank
Nimbostratus
Please, could you write comprehensive ?
- Azerturkbank
Nimbostratus
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.
- Azerturkbank
Nimbostratus
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"
}
}
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" } }
- Azerturkbank
Nimbostratus
Thank you for your help.
I will test it.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com