22-Jul-2020 19:34
I am trying to get an irule working for redirecting a url to a different one.
When users connect *.host1.abc.com it needs to redirect to *.host2.xyz.com
when HTTP_REQUEST {
if { [class match [string tolower [HTTP::host]] contains *.host1.abc.com redirect] } {
*.host2.xyz.com
#log local0. "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri]" }
}
}
22-Jul-2020 19:47
i tried using the below irule no luck so trying to understand where my logic is failing. If i can get the working irule that would be great
when HTTP_REQUEST {
if { [class match [string tolower [HTTP::host]] contains *.host1.abc.com ] } {
{ HTTP::redirect " *.host2.xyz.com" /[HTTP::uri]
#log local0. "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri]" }
}
}
23-Jul-2020
14:14
- last edited on
04-Jun-2023
21:21
by
JimmyPackets
Hi Sam10,
Can you try this?
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "host1.abc.com" } {
set host [string map -nocase {"host1.abc.com" "host2.xyz.com"} [HTTP::host]]
HTTP::redirect "http://$host[HTTP::uri]"
}
}
27-Jul-2020 16:57
No luck , still running into the issue , page cannot be displayed.
I see the response going to the backend server , but server never responding back. I see a syn from F5 ,after 3 TCP retransmission from F5 , no response from the server . F5 is closing the connection .
This is the request i see in wireshark from client to F5.
GET / HTTP/1.1
Host: tools.host1.abc.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Upgrade-Insecure-Requests: 1
But no response from the backend the server.
28-Jul-2020 08:26
thankyou , finally got this working as expected.