Forum Discussion
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"
}
}
Sep 24, 2019
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"
}
}