Forum Discussion
iRule
Cirrus
Mar 08, 2023replace part of URI for specific URL and pass remaining
Dear Community, I need to replace only specific part of URI i.e "/abc/defg/" with "/uvw/xyz/" in a URL. All other URLs should not be altered. "/abc/defg/" will appear in the begning of URI For e...
- Mar 13, 2023
iRule It should be the following and any other additions can be added in a similar manner. You might consider speaking with the application team and have them perform the corrections on the server as this should only be done as a last resort in an iRule.
when CLIENT_ACCEPTED priority 500 { set DEFAULT_POOL [LB::server pool] } when HTTP_REQUEST priority 500 { if {[string tolower [HTTP::uri]] starts_with "/abc/defg/"} { HTTP::uri [string map {"/abc/defg/" "/uvw/xyz/"}[HTTP::uri]] pool pool_web } elseif {[string tolower [HTTP::uri]] starts_with "/123/456/"} { HTTP::uri [string map {"/123/456/" "/78/910/"}[HTTP::uri]] pool pool_web } elseif{[string tolower [HTTP::uri]] starts_with "/asdf-asdf/"} { HTTP::uri [string map {"/asdf-asdf/" "/lkjh-lkjh/"}[HTTP::uri]] pool pool_web } else { pool ${DEFAULT_POOL} } }
Paulius
MVP
Mar 09, 2023iRule The irule above should work but the following can be used to see if that fixes your issue in conjunction with a /32 OneConnect profile associated to the VS.
when CLIENT_ACCEPTED priority 500 {
set DEFAULT_POOL [LB::server pool]
}
when HTTP_REQUEST priority 500 {
if {[string tolower [HTTP::uri]] starts_with "/abc/defg/"} {
HTTP::uri [string map {"/abc/defg/" "/uvw/xyz/"}[HTTP::uri]]
pool pool_web
} else {
pool ${DEFAULT_POOL}
}
}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