Forum Discussion
Manoranajn_3164
Nimbostratus
Apr 06, 2017Custom Response to disallowed geo location
Hello
So, I have been trying to create an iRule that can enable me to present a custom response in case a user access application from a disallowed geo-location, but its not working. following is t...
Kai_Wilke
MVP
Apr 08, 2017Hi Manoranajn,
take a look to the iRule below. It uses a less complicated approach to debug log the violation data and updates in addition the "Content-Length" header information, after changing the response.
when ASM_REQUEST_BLOCKING {
set x [ASM::violation_data]
log local0.debug "violation=[lindex $x [set i 0]]"
log local0.debug "support_id=[lindex $x [incr i]]"
log local0.debug "web_application=[lindex $x [incr i]]"
log local0.debug "severity=[lindex $x [incr i]]"
log local0.debug "source_ip=[lindex $x [incr i]]"
log local0.debug "attack_type=[lindex $x [incr i]]"
log local0.debug "request_status=[lindex $x [incr i]]"
if { [lindex $x 0] contains "ATTACK_TYPE_OTHER_APPLICATION_ACTIVITY" } then {
log local0.debug "ATTACK_TYPE_OTHER_APPLICATION_ACTIVITY detected, let's customized reject page"
ASM::payload replace 0 [ASM::payload length] ""
ASM::payload replace 0 0 "Request Rejected PageSorry, access to this site is restricted."
HTTP::header remove "Content-Length"
HTTP::header insert "Content-Length" [ASM::payload length]
}
}
Cheers, Kai
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
