Forum Discussion
ebrc
Nimbostratus
Aug 29, 2019iRule to modify response code for ASM blocking page
Hello everyone, I would love to receive your help to create an irule allowing me to modify the response code (with a 500) of the blocking page of ASM when an illegal request is matched. The go...
Aug 30, 2019
Hi,
iFile (asm_custom_response):
<html>
<head>
<title>Request Rejected</title>
</head>
<body>
The requested URL was rejected. Please consult with your administrator.<br><br>
Your support ID is: $supportid <br><br><a href='javascript:history.back();'>[Go Back]</a>
</body>
</html>
iRule:
when HTTP_REQUEST {
set asmstatus "allowed"
}
when ASM_REQUEST_BLOCKING {
set asmstatus "blocked"
set supportid [ASM::support_id]
}
when HTTP_RESPONSE_RELEASE {
# log local0. "ASM Status = $asmstatus"
if { $asmstatus equals "blocked" } {
# log local0. "Support ID = $supportid"
HTTP::respond 500 content [subst -nocommands -nobackslashes [ifile get asm_custom_response]]
}
}
- ebrcSep 05, 2019
Nimbostratus
Thank you eaa!
I will try and give feedback then.
There is no way to just keep the ASM blocking page from ASM policy (that we already replaced by the customer's one) and just replace the error code?
I think your way will work, but we will have to maintain the same blocking page in 2 different places (ASM + ifile)
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