Hi I’m quite new to this, so please forgive me if this is something that you’ve seen before and have already answered.
I have an iRule that I wrote as more of a proof of concept. Basically I want to take connections to the default document and re-direct them with a parameter based on part of the host name. The following does what I want, but I’m looking for a better way to do it that can scale, to say 300 host names… From what I understand, this should be something that can be done using the scan command, but to be honest, it’s a bit confusing for me.
when HTTP_REQUEST {
if { ([HTTP::host] equals “site1.domain.com”) and ([HTTP::uri] equals “/”) } {
Just keep in mind that requests to the default document can also include the filename of the default document.
In other words, if your web servers are configured to treat “index.html” as the default document a request to “/index.html” should be treated as a request to “/”.
I just spotted another problem in your rule: you’re using HTTP::uri. However, this includes the querystring. In other words, a request to “http://domain.com/?refid=campaign5” would not be redirected. You’ll want to use HTTP::path instead.
Note: the documentation mentions that only a question mark (?) is parsed as a seperator. Depending on the situation this may still allow someone to bypass the redirect.
That’s definitively a good thing to be aware of. In my case, the root of my sites are empty except for a asp page as default document that does this redirect, so I’m not too worried about people trying to push parameters there and not being redirected. Still, it’s a good thing to have, so I will use HTTP::path instead. Thanks Arie
That’s definitively a good thing to be aware of. In my case, the root of my sites are empty except for a asp page as default document that does this redirect, so I’m not too worried about people trying to push parameters there and not being redirected. Still, it’s a good thing to have, so I will use HTTP::path instead. Thanks Arie