Forum Discussion

Thiyagu_163984's avatar
Thiyagu_163984
Icon for Nimbostratus rankNimbostratus
Aug 26, 2017

Difference between the Irules for redirection:

Hello All, Could you please help me to know is there any functional difference between the following Irules for htpp to https redirection:

 

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

 

1- is there a specific reason to use the option "get field" 2- Is there any functional difference which would in turn would help the redirection performance?

 

Regards, Thiyagu

 

2 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    There's no difference except for the 2nd irule with "getfield" strips off any non standard port, should you have used one in the original http request i.e. http://www.example.com:8080. The redirect will strip off 8080 when changing to HTTPS.

     

    Hope this helps,

     

    N

     

  • Hope this also give you some extra understanding on the getfield function.

    Also you can playaround with the getfield, something like below.

    when HTTP_REQUEST {
    set VIP [getfield [HTTP::host] ":" 1]
    set a [getfield $VIP "." 1]
    set b [getfield $VIP "." 2]
    set c [getfield $VIP "." 3]
    set d [getfield $VIP "." 4] 
    log local0. "$VIP - IP, $a $b $c $d"
    }
    

    When the VIP is directly accessed,So on the console this would log something like below, where ":" and "." are the delimiters. Hope this clarifies.

    Rule /Common/test-rule : 20.30.40.50 - IP, 20 30 40 50