Forum Discussion
Help in improve URI based irule
Hello Folks
I have the following situation...
Im deploying LTM in front of SharePoint farm that will host our new website
We are moving content from our old web servers to our new Sharepoint servers... In the process i Need
everytime anyone access http://mycoolapp.com/ I need to have this request being sent to pool_A ( since Sharepoint will send a 301 for redirect to http://mycoolapp.com/Paginas/default.aspx I need this request also being sent to pool_A... Any other URI /styles, /library, etc should be sent to Pool_B
I created the irule below which does what I need in a very inefficient way
Can anyone provide a better more efficient example please!
Thanks a lot!
when HTTP_REQUEST { if { [HTTP::uri] == "/" } { pool pool_A log local0. "Home page hit /" } elseif { [HTTP::uri] == "/Paginas/default.aspx" } { pool pool_A log local0. "redirected to Paginas/default.asp" } elseif { [HTTP::uri] contains "/Style%20Library" } { pool pool_B log local0. "searching STYLES in server 26" } elseif { [HTTP::uri] contains "/_layouts" } { pool pool_B log local0. "searching LAYOUTS in server 26" } else { pool pool_B log local0. "SERVER 29" } }
3 Replies
- Michael_Jenkins
Cirrostratus
I'd recommend simplifying your iRule to something like the following if you were still wanting to use it. Otherwise, I'd suggest using a Local Traffic Policy to check the uri (and if need be, the hostname), and assign the pool that way. Using the policy, you could just have a default pool,
assigned to the Virtual Server, and then in the policy change the pool forpool_B
and/
. Because the policy method is built-in, it's more efficient than using an iRule./Paginas/default.aspxwhen HTTP_REQUEST { switch -glob -- [string tolower [HTTP::path]] { "/" - "/paginas/default.aspx" { log local0. "Pool A: '[HTTP::path]'" pool pool_A } default { log local0. "Pool B: '[HTTP::uri]'" pool pool_B } } } - Glenn_32974
Nimbostratus
Thanks a lot Miachel! Your recommended irule worked perfectly! I'll try to test the policies to see the results but I think the irule will do!
- Michael_Jenkins
Cirrostratus
Great. Please mark the answer as the solution if you don't mind.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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