Redirect HTTP non standard port (9090) to HTTPS with iRule

Hello all. I know there are a number of articles about that. But I was not able to find anything like that, sorry if I’m wrong.

I have a VS that listen on the HTTP port 9090 and it work as expectd. Now I need to do a simple HTTP / HTTPS redirect but I cannot make it work. The iRule is the usual one:

when HTTP_REQUEST {

HTTP::redirect “https://[HTTP::host][HTTP::uri]”

}

I thought that the iRule inherit the HTTP port from the VS, but it does not work. Can someone tell me how I can make the iRule work for the HTTP port 9090?

Thanks in advance.

Stefano.

Simply add the port into the redirect, like so

when HTTP_REQUEST {
  HTTP::redirect "https://[HTTP::host]:9090[HTTP::uri]"
}