Forum Discussion
wi_Tek_122810
Nimbostratus
Jun 18, 2013Problem with TCL in payload check
Hello,
First - sorry for my bad english.
Second - I must write iRule which allow login in "normal mode" for some users (identified by 'kod_swd') and block for others (or redirect to loginse...
wi_Tek_122810
Nimbostratus
Jun 18, 2013Old code was too complicated 😉
New - works perfectly (witch extra logging).
I was made two classes with urls and kod_swd.
when HTTP_REQUEST {
if { [HTTP::header exists "Content-Length"] && [HTTP::header "Content-Length"] < 1048577 } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1048576
}
HTTP::collect $content_length
set collected 0
set lurl [string tolower [HTTP::uri]]
set usrip [IP::client_addr]
log local0.warn "REQ $usrip ; $lurl"
}
when HTTP_REQUEST_DATA {
if { ([IP::addr 10.112.0.0/16 equals [IP::client_addr]]) and ([class match $lurl equals "ws_login_url"]) } {
set kod_swd [substr [findstr [HTTP::payload] "ctl00%24ContentPlaceHolder1%24txtKodSwiadcz" 44] 0 "&ctl00%24ContentPlaceHolder1%24txtId"]
set user [substr [findstr [HTTP::payload] "ctl00%24ContentPlaceHolder1%24txtId" 36] 0 "&ctl00%24ContentPlaceHolder1%24txtSinakeValue"]
log local0.warn "REQ_DATA $usrip ; $lurl ; $kod_swd ; $user"
if { [class match $kod_swd eq "ws_login_swd"] } {
HTTP::release
log local0.warn "REQ_DATA - jest ok $usrip ; $lurl ; $kod_swd ; $user"
} else {
HTTP::redirect "https://[HTTP::host]/clo_ws/loginservice.aspx"
log local0.warn "REQ_DATA - redirect $usrip ; $lurl ; $kod_swd ; $user"
}
}
}
Maybe it helps somebody.
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