Forum Discussion
All variables have scope of TCP session. Or do you mean users browser session? You could add in a session cookie to help you with that.
Also when you say 'html text "banana"' do you mean if you see the word 'banana' in the content of an HTTP response?
A bit more info and we can give you some code to illustrate.....
- IheartF5_45022Jan 20, 2017Nacreous
Create a stream profile str_banana that looks for string 'banana', then attach an iRule as follows;-
when STREAM_MATCHED { if {![HTTP::cookie exists 'banana']} { Insert session cookie HTTP::cookie insert name 'banana' value "1" HTTP::cookie httponly 'banana' enable log local0. "Banana seen for this session" } STREAM::disable }
- jspiglerj2rsolvesJan 20, 2017Nimbostratus
Sorry if my requirements weren't clear. My use case wasn't the greatest. I'm simply trying to track within the Big-IP when a specific criteria is met, carry out action X and don't do it again for the duration of the users session. Unfortunately setting a cookie on the clients end is not an option. Doing further research, would setting the value in the session table work?
Something like this
when HTTP_REQUEST {
if { [table -subtable lookup [IP::client_addr] [HTTP::host]] !=""} { return }elseif { ([HTTP::header value host] contains "web.company.com")} { log local0. "Criteria met for [IP::client_addr] for [HTTP::header value host] in request" table set -subtable [IP::client_addr] [HTTP::host] }
}
when CLIENT_CLOSED {
table delete -subtable [IP::client_addr]
}
- jspiglerj2rsolvesJan 20, 2017Nimbostratus
I don't think my syntax is correct though...
- jspiglerj2rsolvesJan 20, 2017Nimbostratus
I think I got the syntax right
when HTTP_REQUEST {
if { [table lookup -subtable [IP::client_addr] [HTTP::host]] !=""} { return }elseif { ([HTTP::header value host] contains "web.company.com")} { log local0. "Criteria met for [IP::client_addr] for [HTTP::header value host] in request" table set -subtable [IP::client_addr] keys [HTTP::host] }
}
when CLIENT_CLOSED {
table delete -subtable [IP::client_addr] -all
}
I'm going to test tomorrow.
- IheartF5_45022Jan 20, 2017Nacreous
Honestly - no need to use a 'table' command at all, and def no need to use subtable....