Forum Discussion
Pankaj_Kakade_7
Nimbostratus
Apr 24, 2015HTTP Response with iRule
Hello Team
I need help to set iRule to respond 404 page not found. If
1) HTTP request is https://abc.com irule should respond 404 Page not found
2) HTTP request is https://abc.com/test i...
Hannes_Rapp
Nimbostratus
Apr 24, 2015"I tried below iRule but it respond with 404 in both cases" This does not sound right. Note that the value of URI you're using in your conditional statement is HTTP path + Query. It's not the same thing as URL.
For your request, use the iRule below:
when HTTP_REQUEST {
if {[HTTP::path] equals / }{
HTTP::respond 404 content "HTTP ERROR 404 Reason:Not Found" Mime-Type "text/html"
event disable
TCP::close
} elseif { [string tolower[HTTP::path]] starts_with /test }{
return
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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