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.
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
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