Forum Discussion

LeonS_296027's avatar
LeonS_296027
Icon for Nimbostratus rankNimbostratus
Feb 13, 2018

iRule to for http redirect with custom port.

I have flowing problem Client is going to connect as folowing: https://mydomain.com:14444

 

I had set up a vserver for it and everything is working. I need to create a iRule for HTTP redirect for following case:

 

http://mydomain.com:14444

 

Standard http redirect does not work when HTTP_REQUEST { HTTP::redirect https://[HTTP::host][HTTP::uri] }

 

I had created following custom iRule:

 

when HTTP_REQUEST {

 

HTTP::redirect https://[getfield [HTTP::host] ":" 1]:14444[HTTP::uri] }

 

It does not work too.

 

  • Your iRule should have worked. Anyway, try this one:

     

    when HTTP_REQUEST {

     

    log local0. "https://[getfield [HTTP::host] ":" 1]:[getfield [HTTP::host] ":" 2][HTTP::uri]" HTTP::redirect https://[getfield [HTTP::host] ":" 1]:[getfield [HTTP::host] ":" 2][HTTP::uri]

     

    }