Forum Discussion
Irule help needed
Hello, please find below the irule reposted. The badlink is trapped here :
when HTTP_REQUEST {
if {[HTTP::host] eq "www.service.com" and [HTTP::uri] starts_with "/_badlink/" } {
switch -glob [string tolower [HTTP::uri]] {
"*.pdf" {
set message "illegal file download !!!"
HTTP::respond 200 content [subst -nocommands -nobackslashes [ifile get message.html]] noserver "Content-Type" "text/html"
}
}
}
}
You can create an ifile by importing your html content in System > File Management > Import ifile
Then you create an ifile object that refer to the ifile content previously imported in Local Traffic > iRules > iFile List. In the irule you refer to the ifile object created in iRules > iFile List tab
For the html content itself, it's up to you to create an html message with your own look&feel. The bonus is that you just have to set $message in the html file where you want the irule to replace this variable by the value.
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