Forum Discussion
qqdixf5_74186
Nimbostratus
Oct 03, 2007iRule to access database
Is it possible to create an iRule that do something like getting a http header value and checking it against a database? We used to do this using Reactivity. Now we are trying to see if BigIP can do t...
Lars_Terje_Vaal
Nimbostratus
Oct 08, 2007Hi qqdixf5
I have created a working solution for calling another website, doing a vaildation and resending the original request. This solution sends the source IP and the path to a validation site, which checks that this IP are allowed to access this path. (this is just an example, but I have some similar working code which I don't want to post in an open forum ;-), so there may be some missing variables or something).
when CLIENT_ACCEPTED {
set client_approved 0
}
when HTTP_REQUEST {
set orginal_request [HTTP::request]
if {!$client_approved} {
If client not approved yet, check the clients IP against the checkIP.aspx site at the backend servers
set checkuri "/checkIP.aspx?ip=$SourceIP&path=[HTTP::path]"
HTTP::uri $checkuri
}
}
when HTTP_RESPONSE {
if {!$client_approved} {
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1000000
}
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
}
Reads the response, and validates if response contanis Accespted
when HTTP_RESPONSE_DATA {
if {!$client_approved} {
set payload [HTTP::payload]
Check wether response contains Accepted. In that case set client approved to true.
if {$payload contains "Accepted"} {
set client_approved 1
if response contains Accepted, the original_request is sent
HTTP::retry $orginal_request
}
}
}
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
