Forum Discussion

Cleiton_Lobo_de's avatar
Cleiton_Lobo_de
Icon for Nimbostratus rankNimbostratus
Sep 21, 2019

Allow access to URI-based Internet specific URL

I am trying to develop an irule whereby access to a specific URL is allowed only when a specific URL is presented .

 

The URL specifies abc.domain.com/marketplace must be available for external and internal network.

 

Other all URLs abc.domain.com/* must be available for internal network only (rfc 1918 addresses)

 

regards

 

2 Replies

  • Hi,

    Can you try this iRule?

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "abc.domain.com"} {
    		if { not ([string tolower [HTTP::uri]] starts_with "/marketplace") } {
    			switch -glob [IP::client_addr] {
    				"10.*" -
    				"192.168.*" -
    				"172.16.*" -
    				"172.17.*" -
    				"172.18.*" -
    				"172.19.*" -
    				"172.20.*" -
    				"172.21.*" -
    				"172.22.*" -
    				"172.23.*" -
    				"172.24.*" -
    				"172.25.*" -
    				"172.26.*" -
    				"172.27.*" -
    				"172.28.*" -
    				"172.29.*" -
    				"172.30.*" -
    				"172.31.*" {
    					# log local0. "Host: [HTTP::host] Uri: [HTTP::uri] ClientIP: [IP::client_addr]"
    				}
    				default {
    					reject
    				}
    			}
    		}
    	}
    	else {
    		reject
    	}
    }