Forum Discussion
princess_baile1
Oct 16, 2010Nimbostratus
HTTP Rewrite/Redirect need help for newbie
Hi,
I am very new to iRules and I need help accomplishing the following:
the typical request will look something like this: https://ixgi-commonuat.xxx.com/pms-...rvice?ws...
The_Bhattman
Oct 17, 2010Nimbostratus
Hi Tamara,
I don't believe you need to use "/" after both URLs. Remember string maps simple find and replace over one iteration.
This untested example code. It will send the traffic to the pool of it matches the first condition. If it matches the second condition it will change the URI and send the request to pool, but the client will still retain the original URI.
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/pmx/*" {
pool pool_XGI_fab_PMXComponent_uat_443 }
"/pmx-fix/*" {
HTTP::uri [string map { pmx-fix pmx } [HTTP::uri]]
pool pool_XGI_fab_PMXProdfixComponent_pfix_443
}
}
}
or
This untested code works much similar to the code above, except the client now has the new updated URI.
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/pmx/*" {
pool pool_XGI_fab_PMXComponent_uat_443 }
"/pmx-fix/*" {
set newuri [string map { pmx-fix pmx } [HTTP::uri]]
HTTP::redirect "http://[HTTP::host]/$newuri"
}
}
}
I hope this helps
Bhattman
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