Forum Discussion
Albert__Tase_70
Nimbostratus
Mar 19, 2008ssl persistance and base on uri contents
Is there a way to use irule like this
when https request comes in to vip if the request contains x in the uri use ssl persit profile and use pool x
else use pool y
????
thanks
13 Replies
- Nicolas_Menant
Employee
Hi,
You can do this by making the BIGIP be the SSL termination.
Then in the HTTP request event you can do the following:
when HTTP_REQUEST {
if { [HTTP::uri] contains "x" } {
persist ssl [SSL::sessionid] 1800
}
}
where 1800 here is the timeout
The default pool of your vs should be pool y
HTH - The_Bhattman
Nimbostratus
Another alternative code would look like the following:when HTTP_REQUEST { switch [HTTP::uri] { "x" { persist ssl [SSL::sessionid] 1800 pool poolx } "y" { pool pooly } } }
orwhen HTTP_REQUEST { if { [HTTP::uri] eq "x" } { persist ssl [SSL::sessionid] 1800 pool poolx } else { pool Pooly } }
thanks
/CB - Nicolas_Menant
Employee
[ERROR FIXED] - The_Bhattman
Nimbostratus
It was a cut and past error I just fixed.
/CB - Albert__Tase_70
Nimbostratus
I tired the following and can't seem to get the syntax right
when HTTP_REQUEST { if { [HTTP::uri] eq "x" } { persist ssl [SSL::sessionid] 1800
pool poolx
} else {
pool Pooly
} }
line 3: [wrong args] - Nicolas_Menant
Employee
Hi,
try this one:
when HTTP_REQUEST {
if { [HTTP::uri] eq "x" } {
persist uie [SSL::sessionid] 1800
pool poolx
} else {
pool Pooly
}
} - Nicolas_Menant
Employee
yes it's normal PROFILE::persist command is to retrieve data, not set them up.
As i said try those iRules:
try this one (it is uie instead of ssl and it's normal^^):
when HTTP_REQUEST {
if { [HTTP::uri] contains "x" } {
persist uie [SSL::sessionid] 1800
pool poolx
} else {
pool Pooly
}
or this one:
when HTTP_REQUEST {
if { [HTTP::uri] contains "x" } {
persist ssl
pool poolx
} else {
pool Pooly
}
}
be careful in those iRules, the uri must contains x. eq "x" is not a good idea since a URI will at least start with "/" so it will never match simply x - The_Bhattman
Nimbostratus
According to the wiki PROFILE::persist doesn't set the persistance but simply returns a value after it is selected
Here is another approach
Create SSL Persistenace and assign it to the VIP then in your irulewhen HTTP_REQUEST { if { [HTTP::uri] eq "/x" } { pool poolx } else { persist none pool pooly } }
Hope that helps
/CB - Nicolas_Menant
Employee
Hi,
As i said HTTP::uri will never be equal to X since it will start by a "/"
so if you wanna try CB method i'd advise to do a eq "/x" or a contains "x"
when HTTP_REQUEST {
if { [HTTP::uri] eq "/x" } {
pool poolx
} else {
persist none
pool pooly
}
} - Albert__Tase_70
Nimbostratus
ok when i use the last post it still not working
if I use the following
when HTTP_REQUEST {
if { ([HTTP::uri] contains "x")}{
HTTP::redirect "https://x.x.x.x:8443/x/"
} else {
pool y
}}
however they do not want to have the redirect
in the above the redirect sends it to the virtual with the same pool assigned as the below and I get whats expected
however the redirect seems to affect the app why can't I when it matches send it to the pool that has the servers in it that the vip has that when I redirect to it gives me the expected results.
when HTTP_REQUEST {
if { [HTTP::uri] contains "x"}{
persist uie [SSL::sessionid] 1500
pool x
} else {
pool y
}
}
thanks
Al
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