Appending the URI to the incoming request

Hi Guys,

I hope someone must have had a similar requirement and may help me quickly… I have a web server which is accessible by typing “company.service1.com/xx/yyy” . I want the users to type in their browser only “company.service1.com” can someone help me with an irule that can add this “/xx/yyy” to the incoming request to avoid the users from typing all of that.

Regards,

Either;

when HTTP_REQUEST {
    if {[HTTP::path] eq "/" } {
         This will give you a 'stealth' change of path
        HTTP::uri "/xx/yyy"
    }
}

or

when HTTP_REQUEST {
    if {[HTTP::path] eq "/" } {
         This will show the change of path in the users browser
        HTTP::response 301 Location "http://company.service1.com/xx/yyy"
        return
    }
}

Thank IheartF5

I have one more query this iRule when attached to the Virtual Server will only be invoked during the initial URL request only m i correct? and it will not disturb the further requests or it will try to intercept every request?

Regards,

The HTTP_REQUEST event and iRule will be triggered for every request, but the

if {[HTTP::path] eq "/" } {

ensures that the redirect or path rewrite will only be executed when the request is for “/”

Thanks Iheart…

After putting the iRule I am feeling a bit of slowness in response and the page load times where as if I was typing the complete path it was fast… any suggestions… ??

Regards,

Which version did you use - redirect or rewrite?

I have used this one.

when HTTP_REQUEST {
    if {[HTTP::path] eq "/" } {
         This will give you a 'stealth' change of path
        HTTP::uri "/xx/yyy"
    }
}

I have used this one.

when HTTP_REQUEST {
    if {[HTTP::path] eq "/" } {
         This will give you a 'stealth' change of path
        HTTP::uri "/xx/yyy"
    }
}

This works only if the client doesn’t use the actual file name of the home page. If the home page ever does a postback this is guaranteed to be an issue, but I’d also be weary of users who tack it onto their original request. You may want to check for that (e.g. index.html, default.aspx).

This works only if the client doesn’t use the actual file name of the home page. If the home page ever does a postback this is guaranteed to be an issue, but I’d also be weary of users who tack it onto their original request. You may want to check for that (e.g. index.html, default.aspx).

There’s no reason at all that this should cause a performance issue of any sort. Are you sure something else hasn’t changed that affects the page load?

Yes I am sure nothing else has changed when i write the complete URL it comes up very fast when i write incomplete and depend on the Irule to change it it’s taking time.

One more thing guys… this was a https website now I want to create a http VS and write an irule that if someone types in “http://company.service1.com” the irule should redirect the user to “https://company.service1.com/xx/yyy” what changes shall i make to the above irule

if {[TCP::local_port] == 80} {
    HTTP::respond 301 Location "https://company.service1.com/xx/yyy"
} elseif {[HTTP::path] eq "/" } {
     This will give you a 'stealth' change of path
    HTTP::uri "/xx/yyy"
}

Thanks Iheart… it all worked… thanks alot…