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?wsdl and I want to change the "/pms-fix" to "/pms" and retain the rest of the uri as it might change. I also will have uri's that come in with /pms already that do not have to be rewritten but will need to go to a different pool than the pms-fix traffic. I have pieced this together from some iRules we already have and reading here on the forums and I know it isn't quite right but any help is GREATLY appreciated.
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/pms"} {
log local0. "GOING TO pool_XGI_fab_PMSComponent_uat_443"
pool pool_XGI_fab_PMSComponent_uat_443
}
log local0. "PMS my uri is [HTTP::uri]"
HTTP::uri [string map {/pms-fix/ /pms/} [HTTP::uri]]}
if {uri eq "/pms/"} log local0. "uri changed from pms-fix to pms"
pool pool_XGI_fab_PMSProdfixComponent_pfix_443
here is my first question, in the string map do I need a "/" after both uri's? then does including the [HTTP::uri]]} append the remainder of the uri after the pms-fix and pms?
thank you!
Tamara
- The_BhattmanNimbostratusHi Tamara,
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 } } }
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" } } }
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