Forum Discussion

ShakN_167332's avatar
ShakN_167332
Icon for Nimbostratus rankNimbostratus
Aug 20, 2014

Need help in Irule redirection for multiple sites.

in our setup we have sites which are accessed by internal users as well as internet users via http and https. so we have created 4 VS (2 internal VS, one for http and one for https for internal users) and (2 for internet users 1 for http and one for https). our requirement is any lan user access sites via http than it should be http if lan users type https than it should redirect to http. similarly if any internet users access sites via http than it should redirect to https. this is done by 1 irule one for http to https redirection.

 

when RULE_INIT { set static::bsint "internet.abc.com" set static::sitesint "sites.internet.abc.com"

 

} when HTTP_REQUEST { if {[class match [IP::client_addr] equals InternalHosts]} { HTTP::redirect http://[HTTP::host][HTTP::uri] } else { switch -glob -- [string tolower [HTTP::host]] { "sites.abc.com" { HTTP::header replace Host $static::sitesint STREAM::disable } "abc.com" { HTTP::header replace Host $static::bsint STREAM::disable } } } } when HTTP_RESPONSE { if {[HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains $static::sitesint}{ HTTP::header replace Location [string map "$static::sitesint $static::sitesext" [HTTP::header Location]] }

 

elseif {[HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains $static::bsint}{ HTTP::header replace Location [string map "$static::bsint $static::bsext" [HTTP::header Location]]

 

}

 

in addition to it i need to redirect below redirection in same irule please guide me how to do this.

 

if any one access from internet to the below url

 

https://asites.abc.com/xyz/finance

 

than it should redirect to

 

http://asites.internet.abc.com/sites/finance

 

and many more sites like this.

 

please some one help me in this.thank you in advance.

 

53 Replies