Forum Discussion
irule URI Match and replace function disrupting website format
We have a published webapp xyz.com which has the following irule for URI match and replace functionality for certain internal links. below is a functional irule for the site which works fine.
/*START IRULE/
when HTTP_REQUEST { HTTP::header remove Accept-Encoding STREAM::disable
if { [HTTP::uri] equals "/" } {
HTTP::header replace "Host" "server1.domain:888"
HTTP::uri "/lllxy/"
pool ABC member 1.2.3.4
}
if { [HTTP::uri] equals "/yyy/" } {
HTTP::header replace "Host" "server1.domain:888"
HTTP::uri "/yyy/"
pool ABC member 1.2.3.4
}
}
when HTTP_RESPONSE { if { [HTTP::header exists Location] } { HTTP::header replace Location [string map {"server1.domain:888" "xyz.com"} [HTTP::header Location]] } STREAM::disable STREAM::expression "@server1.domain:888@xyz.com@" STREAM::enable }
/*END IRULE/
Whenever we append and add another URI match and replace string for a different node on the same irule, the website looses its formatting. here is what we are adding.
/******Under HTTP_REQUEST *****/
if { [HTTP::uri] equals "/www/" } { HTTP::header replace "Host" "server100.domain:666" HTTP::uri "/www/" pool ABC member 9.9.9.9 }
/******Under HTTP_RESPONSE *****/
if { [HTTP::header exists Location] } {
HTTP::header replace Location [string map {"server100.domain:666" "xyz.com"}
[HTTP::header Location]]
}
STREAM::disable
STREAM::expression "@server100.domain:666@xyz.com@"
STREAM::enable
}
Don’t know if the syntax is correct or are we missing something.
Any guidance in the right direction will be helpful.
3 Replies
- Samir_Jha_52506
Noctilucent
Don't see any issue with iRule.
function works if you will add stream profile in VIP. Try this option. Go to VIP --> Advance --> Stream Profile --> stream(default)STREAM- RenashC
Nimbostratus
You should not have multiple STREAM::disable and STREAM::enable in the under HTTP_response, unless you have them in an IF-ELSE or IF-IF separation.
Can you paste the final iRule?
- AJN_Network_Tea
Nimbostratus
yes, you are right. Got further info from the below answer.
 
https://devcentral.f5.com/s/feed/0D51T00006i7Xc9SAE
 
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