iRule redirect syntax

Hello,

I’m trying to create a simple redirect irule for a VIP i created for port 8080. Obviously users are typing in the following

http://mywebsite.com and it’s failing as it needs to be http://mywebsite.com:8080/imagecast/default.asp

I’ve tried the following iRule and I can get the VIP to redirect when i manually type in :8080. I would like this to redirect the user to the correct port and file extension:

when HTTP_REQUEST { if { [HTTP::uri] equals “” or [HTTP::uri] equals “/” } { HTTP::redirect http://mywebsite.com:8080/imagecast/default.asp }}

I’ve tried a few different things but doesn’t seem to be coming close.

Hi,

did you create a VS on port 80?

on this VS create the following irule:

when HTTP_REQUEST { 
    HTTP::redirect http://[HTTP::host]:8080[HTTP::uri] 
}

Awesome that worked. I actually did change the VS to port 80. When i did that still no dice so i re-wrote my iRule like this:

when HTTP_REQUEST { if { [HTTP::uri] equals “” or [HTTP::uri] equals “/” } { HTTP::redirect http://mywebsite.com/imagecast/default.asp }}

I removed the 8080 and it works fine. Although your method looks like ti will work as well and i will test it. Thank you!!!

Hi,

in your irule, remove the condition [HTTP::uri] equals “” .

an uri is never empty. when the user enter http://mywebsite.com in the browser, the request send is:

GET / HTTP/1.1
Host: mywebsite.com
Other Headers...