Forum Discussion
help with Irule to change url from servername
I'm going to have to make a few assumptions, so please tell me if I'm wrong. First, it would appear that authentication happens on port 7777, while everything else happens on port 8090. The best way to handle that, I believe, would be to create two separate pools of servers, one for each listening port. Second, I'll also assume that any URI that starts with "/sso" is going to the port 7777 service, and everything else goes to port 8090. We can use that to switch between the pools. And finally, I'm assuming the server doesn't actually care what Host header you send it, so if the server received a Host header that equaled "cstest.abc.com", the server would ignore this. If that isn't the case, then the following iRule might get a little more complex. Here's what it might look like though:
when HTTP_REQUEST {
STREAM::disable
HTTP::header remove Accept-Encoding
if { [string tolower [HTTP::uri]] starts_with "/sso" } {
pool my_7777_pool
} else {
pool my_8090_pool
}
}
when HTTP_RESPONSE {
if { [HTTP::header Content-Type] contains "text" } {
STREAM::expression {@match@replace@}
STREAM::enable
}
}
In the HTTP_REQUEST event we'll switch between the pools based on the URI. In the HTTP_RESPONSE event we'll use a STREAM expression to replace any instance of "servername.abc.com:7777" and "servername.abc.com:8090" in the response payload with "cstest.abc.com".
I should also mention that the above precludes any URI mapping, so if you need a client side "/cslogin.html" URI to translate to "/sso/pages/cs_login/login.jsp" on the server side, then that will take a more complex iRule.
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