Forum Discussion
I can't get this Irule to work
Hi Paul,
Just changing the value in the HTTP::header on the request will not affect the routing of the request. I can see what you are trying to do, so I would suggest putting the server that you are trying to direct traffic to in a pool then making your URI modifications if necessary and then directing traffic to the pool (the LTM will take care of the rest).
Something like this:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "dcc.dorsetforyou.com" } {
switch -glob [string tolower [HTTP::uri]] {
"/importer" { pool vmcrglassfish.pool }
"travelclaims" {
HTTP::uri "/SAPTECS/"
pool vmcrglassfish.pool
}
"/" {
HTTP::redirect "https://dorsetforyou.com"
}
}
}
}
NOTE: You do not have to use switch statements (I like them because they are easier to follow and easier to add to if you know you are going to be doing a lot of manipulation on a given Virtual Server).
Hope this helps.
- JRahmOct 06, 2014Adminit depends on the application. For apps like DNN, it does actually route internally based on host header, so as long as IIS is configured correctly, you can send all requests to back end servers that can then hand to the correct portal by header. That said, based on the OP comments, I think your solution is inline with the ask.
- JRahmOct 06, 2014Adminalso, no need for glob unless using some wildcards, but since he is using ends_with, I assume */importer and *travelclaims would be necessary.
- paul_dccOct 07, 2014NimbostratusThanks guys that seems to work fine.
- Michael_Yates_6Oct 07, 2014CirrusAs Jason pointed out, there is no need for the -glob unless you are going to use Wildcards: "*/something" - equivalent to starts_with "/something*" - equivalent to ends_with "/something" - literal (requires exact match) I tend to look to the future when writing switch statements and should have pointed that out.
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