Forum Discussion
custom response per uri with jason code
You 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.
- veredgfSep 23, 2019
Nimbostratus
Hi,
Thanks for the response - question - if I want to give this response to *all* violations on said uri, then would it be better to set this with a traffic policy? Do I need to create three Virtual servers for this? i.e., one with the real vip and two that have a placeholder vip just for the sake of holding the policy? (I have this done on a different site where we differentiate based on host name via traffic policy).
Thanks again,
Vered
- Walter_KacynskiSep 23, 2019
Cirrostratus
Can 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
* 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
