Forum Discussion

NGX_IT_134965's avatar
NGX_IT_134965
Icon for Nimbostratus rankNimbostratus
Nov 26, 2018

Do not allow IP through https

Hello,

 

I am inquiring on how to do the following:

 

Do not allow IP access through HTTPS

 

Example: https://33.33.33.33 < - Don't allow this https://dns.name.com < - Allow this only

 

I am not sure how about to search this through the F5 Dev Central articles, any help is greatly appreciated.

 

Thanks

 

5 Replies

  • Try this:

    when HTTP_REQUEST {
        if { !([string tolower [HTTP::host]] equals "dns.name.com") } {
            reject
        }
    }
    
  • Another Approach will be to add all virtual server IPs in a data group and write a generic irule to deny request, you can either reject or send HTML having access denied message e.g

    ltm rule fqdn_access {
        when HTTP_REQUEST {
            if {[class match [HTTP::host] equals VIP_IPs] }{
                    HTTP::respond 200 content {
                    
                        
                            Access Denied
                 
                
                        We are sorry. Use FQDN to access.
                
                
                        }
                } 
        }
        }
        DataGroup
        ltm data-group internal VIP_IPs {
        records {
        33.33.33.33 { }
        33.33.33.34 { }
    }
    type string
    }
    
    • NGX_IT_134965's avatar
      NGX_IT_134965
      Icon for Nimbostratus rankNimbostratus

      Thank you very much everyone, the first one worked great for me :).