Forum Discussion

ezepsuarez's avatar
ezepsuarez
Icon for Nimbostratus rankNimbostratus
Jan 26, 2022

Redirect all url to another cluster openshift

Currently we have 2 clusters, 1 active and 1 passive, and we configure a url for the user to enter without having to change anything and in case of having to redirect the traffic, it is transparent for the user.


This is our configuration.

Users enter through this url
https://grafana-openshift-monitoring.apps.cluster.company.com/

and then with F5 it should be redirected to the cluster that is active and these 2 can be

https://grafana-openshift-monitoring.apps.cluster1.company.com/
https://grafana-openshift-monitoring.apps.cluster2.company.com/

The idea is that you don't have to rewrite each url, but instead set up an irule that replaces the cluster name within the url and then redirects it.

Any idea how to do it?

1 Reply

  • Hi ezepsuarez,

    Can you try the below iRule, after changed the pool name, members IP addresses, and ports?

    when HTTP_REQUEST {
    	if { [LB::status pool grafana_pool member 10.11.12.101 443] eq "up" } {
    		HTTP::host "grafana-openshift-monitoring.apps.cluster1.company.com"
    		pool grafana_pool member 10.11.12.101 443
    	}
    	elseif { [LB::status pool grafana_pool member 10.11.12.102 443] eq "up" } {
    		HTTP::host "grafana-openshift-monitoring.apps.cluster2.company.com"
    		pool grafana_pool member 10.11.12.102 443
    	}
    	else {
    		HTTP::respond 200 content "Server unavailable"
    	}
    }