Forum Discussion
tabkad_89844
Nimbostratus
Aug 21, 2011irule for port redirection based on Domain names
I have a webserver listening on multiple ports for different urls.
I have made an irule to start with;
I have a webserver listening on multiple ports for different urls.
I have made an irule to start with;
when HTTP_REQUEST {
if {([HTTP::host] eq "abc.com") } {
pool pool_abc
} elseif {([HTTP::host] eq "xyz.com") } {
pool pool_xyz
} elseif { ([HTTP::host] contains "*.abc.com") } {
pool pool_allstar_abc
} elseif {([HTTP::host] contains "*.xyz.com") } {
pool pool_allstar_xyz
}
}
My problem is that the wildcard does not work if there is a request coming from *.abc.com. Each pool is representing different ports in my configuration. Any experts inputs will be highly appreciated.
3 Replies
- The_Bhattman
Nimbostratus
Hi tabkad,
Try the following
I hope this helpswhen HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] { "abc.com" { pool pool_abc} "xyz.com" { pool pool_xyz } "*.abc" { pool pool_allstar_abc } "*.xyz.com" { pool pool_allstar_xyz } } }
Bhattman - tabkad_89844
Nimbostratus
Hi Bhattman,
I tried the following and it just works. But now I faced another hurdle ,
Let me just brief the Application behavior ;
First the user will hit the pool_abc and then for authentication it has to go to pool_allstar_abc. After getting authenticated the server does a url redirection which it has to go back again on pool_abc.
But for me it does not work with this irule as the traffic comes back as http://*.abc.com:3000 and for this reason the user on the internet does not get any response from the Server.
Please advise. - Brian_Deitch_11Historic F5 AccountOn the http profile, set redirect rewrites to matching.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects