Forum Discussion

GianlucaP81_302's avatar
GianlucaP81_302
Icon for Nimbostratus rankNimbostratus
May 23, 2017

IRULE for rewrite hostname and port

Hi,

 

I have to rewrite hostname and port:

 

like that: have to be rewrite to

 

with insideurl DNS resolved with 10.10.10.10, and publicurl DNS resolved with 100.100.100.100

 

How can I do taht with irules?

 

thanks

 

  • Hi,

    You can try this iRule.

    when HTTP_REQUEST {
        if { [HTTP::host] eq "insideurl" and [URI::port [HTTP::uri]] eq "7777" } {    
             HTTP::redirect "https://publicurl:44444/abc[HTTP::uri]"
        }
    }
    

    Regards,

    Martijn