Forum Discussion
Mike_Maher
Nimbostratus
Jan 21, 2016ASM Blocking with multiple formats
I have an application that just a custom HTML response page for all ASM blocks. The application owner is building in new functionality and is asking that for one URL we provide a JSON formatted resp...
gowenfawr
Nimbostratus
Jan 21, 2016We dealt with it in an iRule, and it's pretty simple:
when ASM_REQUEST_BLOCKING {
set asm_info [ASM::violation_data]
if {[string compare -nocase "/web/json-y-page" [HTTP::uri]] == 0} {
ASM::payload replace 0 [ASM::payload length] "{\"response\":\"1\", \"message\":\"Request Rejected. Support ID: [lindex $asm_info 1]\"}"
HTTP::header replace Content-Length [ASM::payload length]
}
}
This will replace the default response page that would otherwise be sent.
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