21-May-2023 14:21
Hello,We have an existing application https://abc.com which is configured with F5.When we open the page and click on status tab it will route to https://abc.com/api-status. Now the users want to see contents of https://abc.com/api-status in a new URL https://xyz.com.Is this achievable?If so can you please share the iRule for this.Appreciate your help.
21-May-2023 16:02
@gopalp I believe this is would be something that has to be tracked server side. You can perform a redirect after someone goes to https://abc.com/api-status to https://xyz.com but because this is most likely going to be a new session to a new FQDN the F5 isn't going to know how to interpret this and provide content to the user. You should be able to provide some sort of transaction ID, cookie, or referer that allows the xyz.com site to know that the user is looking for the contents of the output from abc.com/api-status.
22-May-2023 09:34
@gopalp To perform the simple redirect it would be the following but if you did it on the F5 you would never receive the unique HTTP header from the server to carry over the users session after they went to the path you are referring to.
when HTTP_REQUEST priority 500 {
if {[HTTP::host] == "abc.com"} {
if {[HTTP::uri] == "/api-status"} {
HTTP::redirect "https://xyz.com/"
}
}
}
23-May-2023 15:51
if you control both the abc.com and xyz.com domains, you can do this by hosting both abc.com and xyz.com in your SNI list on the the client-ssl profile of the single virtual (or...use a different virtual and keep the client-ssl profiles separate). And the iRule that @Paulius shared would be on the shared virtual or only on the abc.com virtual. I'd tweak the iRule slightly but it's fine the way it is.
when HTTP_REQUEST priority 500 {
if {([HTTP::host] == "abc.com") && ([string tolower [HTTP::uri]] == "/api-status")} {
HTTP::redirect "https://xyz.com/"
}
}