Forum Discussion
veredgf
Nimbostratus
Sep 22, 2019custom response per uri with jason code
Hi, One of the developers would like to have a Jason custom response for ASM blocking for all pages beginning with (not real page) \blabla\* He would like to put a simple code that will send the se...
Simon_Blakely
Employee
Sep 22, 2019You can do this in an iRule triggered on
when ASM_REQUEST_VIOLATION {
...
if {[HTTP::uri starts_with "/blabla"} {
HTTP::respond 500 content {{"error":"invalid character", errorCode: "1231231"} } Header {Content-Type} {application/json}
}
...
}Otherwise, you need to create a new ASM policy that sets the Violation response to an HTTP 500 response as required. Use a Local Traffic Policy to select between the two ASM policies based on the HTTP::uri.
Walter_Kacynski
Cirrostratus
Sep 23, 2019Can event ASM_REQUEST_BLOCKING be used instead? https://clouddocs.f5.com/api/irules/ASM_REQUEST_BLOCKING.html
- Simon_BlakelySep 23, 2019
Employee
Yes, that's a good option as well.
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
