Forum Discussion
iRule to display Error message and close connection
Hi all, I am looking to get an iRule to drop traffic and return with an Error Message when a string in a particular data group list is matched. The URI is under a data group list called commstgtest. I am using the iRule as below which blocks the page but what I want is to display a an Error Message 'Resource Unavailable' and close the connection.
when HTTP_REQUEST { if {[class match [string tolower [HTTP::uri]] ends_with commstgtest]} { HTTP::close } }
Is this possible to do this?
- iaine
Nacreous
Hi
Before your HTTP::close command, insert a HTTP::respond command then you can send whatever HTTP status code and payload and you need
- ekaleido
Cirrus
Something like this?
when HTTP_REQUEST { if {[class match [string tolower [HTTP::uri]] ends_with commstgtest]} { HTTP::respond 200 content { ErrorError page } } }
- Lee_Sutcliffe
Nacreous
You could use an iRule like this to respond with the message then drop if you want to close the connection
when HTTP_REQUEST { if {[class match [string tolower [HTTP::uri]] ends_with commstgtest]} { HTTP::respond 403 content "Resource Unavailable" drop } }
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