Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Restricting direct access from public IP

Sushant
Altostratus
Altostratus

My website that resides under BIG IP F5 can directly be opened making use of public IP. As my site is one to one NAT'd and and one application under one public IP it can directly be opened using public IP. I want to restrict making use of opening the site directly via the public IP and available only through domain. Please, do let me know if there is any way that I can achieve this .

1 ACCEPTED SOLUTION

If you VIP hosts single domain then use this to whitelist it

when HTTP_REQUEST {
 switch [string tolower [HTTP::host]] {
 "www.domain.com" 
  {
   return
  }
 default { 
   reject
  }
 }
}

If VIP hosts multiple domains/SAN use below to whitelist all

when HTTP_REQUEST {
 switch [string tolower [HTTP::host]] {
 "www.domain1.com" -
 "www.domain2.com" -
 "www.domain3.com" 
 {
   return
  }
 default { 
   reject
  }
 }
}

View solution in original post

5 REPLIES 5

SanjayP
MVP
MVP

You can use iRule, LTM policy or ASM profile to reject the requests coming with IP as HOST header. Let me know if you need further help with any of it.

thank you for the reply...can you share me the irule if possible ?

 

 

  1. when HTTP_REQUEST {
  2. if { [HTTP::header "Host"] equals " " } {
  3. reject
  4. }
  5. }

 

tryin to use this irule without any success

If you VIP hosts single domain then use this to whitelist it

when HTTP_REQUEST {
 switch [string tolower [HTTP::host]] {
 "www.domain.com" 
  {
   return
  }
 default { 
   reject
  }
 }
}

If VIP hosts multiple domains/SAN use below to whitelist all

when HTTP_REQUEST {
 switch [string tolower [HTTP::host]] {
 "www.domain1.com" -
 "www.domain2.com" -
 "www.domain3.com" 
 {
   return
  }
 default { 
   reject
  }
 }
}

thanks ...working now