Forum Discussion

Parveez_70209's avatar
Parveez_70209
Icon for Nimbostratus rankNimbostratus
Sep 06, 2013

Kindly Assist in Understanding the Below Irule

when CLIENT_ACCEPTED { set default_pool [LB::server pool] }

 

when HTTP_REQUEST { check for pages needing to not redirect to https switch -glob [string tolower [HTTP::uri]] { "/getxsl.asp" { pool $default_pool} "/radsomsgreceivertri.asp" { pool $default_pool } "/radsofiletransfer.asp" { pool $default_pool } "/reader.sod" { pool $default_pool } "/clockserver.asp" { pool $default_pool } default { HTTP::redirect https://[HTTP::host][HTTP::uri] } } }

 

Is the above irule stating:

 

HTTP to HTTPS redirect except the extensions: /getxsl.asp,/radsomsgreceivertri.asp,/radsofiletransfer.asp,/reader.sod,/clockserver.asp ??

 

1 Reply

  • Allow me clean that up a bit:

    when CLIENT_ACCEPTED { 
        set default_pool [LB::server pool] 
    }
    when HTTP_REQUEST { 
        check for pages needing to not redirect to https 
        switch -glob [string tolower [HTTP::uri]] { 
            "/getxsl.asp*" { pool $default_pool} 
            "/radsomsgreceivertri.asp*" { pool $default_pool } 
            "/radsofiletransfer.asp*" { pool $default_pool } 
            "/reader.sod*" { pool $default_pool } 
            "/clockserver.asp*" { pool $default_pool } 
            default { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } 
        } 
    }
    

    Is the above irule stating: HTTP to HTTPS redirect except the extensions: /getxsl.asp,/radsomsgreceivertri.asp,/radsofiletransfer.asp,/reader.sod,/clockserver.asp ??

    The answer then would be yes. If the request URI matches any of the defined URIs, traffic will proceed to the GUI-defined pool. If it doesn't match anything, it will fall through to the default condition and redirect to HTTPS. I tweaked it a little bit though. You're using a -glob switch but not defining any glob conditions, so while it would match "/getxsl.asp", it would not match "/getxsl.asp?". Adding the star character at the end allows the URI to grow.