Forum Discussion

Micros_88999's avatar
Micros_88999
Icon for Nimbostratus rankNimbostratus
Oct 17, 2014

LTM check http or https the request and make action to it

Hello,   I have the following iRule, but I would like to make an extra check. If it is coming via http I want to drop it but if it comes via https I would like to allow it.   if { ( [ string to...
  • BinaryCanary_19's avatar
    Oct 17, 2014

    Create a virtual server that listens on the specified IP address, Port 80, and attach that irule to it. Add a redirect for the HTTPS version in an else clause.

    Pseudocode example:

     if (uri_matches) {
        redirect to port 443
     } else {
        accept request (do nothing)
     }
    

    You can also use a condition that checks for "TCP::local_port clientside" and reject if you get 80 (or whatever port your non-HTTP service is listening on).

    Pseudocode example

    if (TCP::local_port eq "80" and uri_matches) { 
       redirect
    }
    

    I'm not aware of a way to ask the question "is this an SSL connection"? Others can chime in if they have better ideas.