Forum Discussion

ShawnO_111386's avatar
ShawnO_111386
Icon for Nimbostratus rankNimbostratus
Dec 30, 2011

SSL Redirect - with one URI exception

I'm trying to create a ssl redirect that will forward all port 80 requests to 443 but want one URI excluded from doing so. I've created the following but my iRule skills aren't sharp enough to figure out what's missing.

 

 

 

 

when HTTP_REQUEST { if {[HTTP::uri] eq "/cpt/cptworkflowservice/" } { switch -glob [string tolower [HTTP::uri]] { { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } } } }
  • is this correct?

    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
            if {not([HTTP::uri] equals "/cpt/cptworkflowservice/")} {
                    HTTP::redirect "https://[HTTP::host][HTTP::uri]"
            }
    }
    }
    
  • Try this:

    
    when HTTP_REQUEST {
        if {!([HTTP::uri] eq "/cpt/cptworkflowservice/") } {
            HTTP::redirect "https://[HTTP::host][HTTP::uri]"
        }
    }
    
  • in case of "not equal".

    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
            if {[HTTP::uri] ne "/cpt/cptworkflowservice/"} {
                    HTTP::redirect "https://[HTTP::host][HTTP::uri]"
            }
    }
    }