Forum Discussion

Tny81's avatar
Tny81
Icon for Nimbostratus rankNimbostratus
6 years ago
Solved

Filter to allow certain URL/URI

Hello,   I have a VIP with multiple DNS alias record tied to it. I’d like to create an irule to allow only certain traffic that matches both host and path. Any other traffic will be rejected.   A...
  • Samir's avatar
    6 years ago

    you can write iRule something below.

    when HTTP_REQUEST {
    if { ([HTTP::host] equals "abc.com" or [HTTP::host] equals "xyz.com") } {
    	if { [HTTP::uri] starts_with "/123/456/" || [HTTP::uri] starts_with "/cat/dog/" } {
    	pool poo_A
    		}
    	else { reject }
    		} 
    	}

     OR

    when HTTP_REQUEST {
    	if { !([HTTP::host] equals "abc.com" or [HTTP::host] equals "xyz.com") && !([HTTP::uri] starts_with "/123/456/" || [HTTP::uri] starts_with "/cat/dog/") } {
    	reject }
    	}