Forum Discussion
ASM 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 response if a block happens. I have looked around and I don't seem to see an easy way to do this outside of writing an iRule or sending that traffic to a different policy. I tried turning on AJAX response blocking and I can't even get to the website with that turned for some reason. Anyone had to deal with this and how did you solve the issue?
1 Reply
- gowenfawr
Nimbostratus
We 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
* 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