Forum Discussion
vkoprivica_9683
Nimbostratus
Jul 19, 2013Redirect url to display blank page
Hi, I have a request to redirect url requests to show blank page. Could this be possible using Irules.
Thank you.
6 Replies
- Kevin_Stewart
Employee
You mean an actual web page that is empty?when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/foo" } { HTTP::respond 200 content "" } } - vkoprivica_9683
Nimbostratus
Yes, can you explain me what each step does?
- Kevin_Stewart
Employee
Sure.
The first line is the event declaration. You want this code to fire when a client makes an HTTP request, so you'll wrap it in the HTTP_REQUEST event.
The next line is the conditional argument. What you're essentially saying is, if the lowercase version of the request URI (the part AFTER the host name) starts with "/foo" (an arbitrary example), perform the following process. The actual URI will be dependent on your environment (what you want to trigger on).
Finally, the HTTP::respond command allows you to preempt the server response, if there was one, and send your own response to the client instead. In this case we're going to send a 200 message (HTTP status code for "OK"), and some arbitrary content, in this case absolutely nothing "". You could literally send anything you wanted with this command - an HTML page, an image or file, JavaScript, css, anything. - vkoprivica_9683
Nimbostratus
Kevin, thank you, I will try to implement.
- vkoprivica_9683
Nimbostratus
Kevin, it turns out this Irule suits the best for the request I had:
when HTTP_REQUEST {
if {([HTTP::uri] eq "/") } { HTTP::respond 200 content "" }
}I was able to apply this irule to the http vip and test it with now problem. Now how can I twik this irule to work on the https vips?
- Kevin_Stewart
Employee
The implementation is exactly the same if you're terminating the client side SSL at the VIP (client SSL profile).
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