Forum Discussion
this value is dynamically changed (like Apple = vendor1;Lemon = vendor2)
Hello guys, I have one problem for which I don't have enough irule's experiences, maybe someone will know...
I need to write irule which takes a value from one url and paste it to another, this value is dynamically changed (like Apple = vendor1;Lemon = vendor2), for example:
https://Hello.world.com/test/sun/A/Apple to redirect to
https://Hello.world.com/test/sun/B/Apple to redirect to
https://Hello.world.com/test/sun/A/Lemon to redirect to
https://Hello.world.com/test/sun/B/Lemon to redirect to
I have been thinking about something like this (just idea):
- when HTTP_REQUEST {
- if { [HTTP::uri] starts_with "/A/*" } {
- set VALUE [substr [HTTP::uri] "$*" ""]
- HTTP::redirect "$*:Olala/blabla"
} }
But I have no idea, how to take * (Apple, Lemon, ... basically whatever is hidden behind *) and insert it into new url, because * will be working like identifier of a particular vendor.
Or is possible to solve this problem via Policy?
Thank you for your hints AK
1 Reply
- Stanislas_Piro2
Cumulonimbus
You can try something like that:
when HTTP_REQUEST { if {[scan [HTTP::uri] "/test/sun/%s/%s" val1 val2] == 2} { switch $val1 { "A" {HTTP::redirect "http://Bad.day.corp/Message?channel1=${val2}:Olala/blabla"} "B" {HTTP::redirect "http://Bad.day.corp/Message?channel2=${val2}:Olala/blabla"} } } }
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