I-Rule Redirect Exception

Hello,

Can you please help me merge the following 3 exceptions into one I rule,

http://<dns>/*/Raf.Services/*

http://<dns>/*/Raf.Rest/*

http://<dns>/Raf.Api/*

I did the test with “Raf.Services”, it works very well, now I want to add the 2 others in the same I rule:

http://<dns>/*/Raf.Rest/*

http://<dns>/Raf.Api/*

The goal is to do,

when HTTP_REQUEST {

if { not ([HTTP::uri] contains “Raf.Services”)} {

log local0. “--redirect-- Request : [HTTP::uri]”

HTTP::redirect https://[getfield [HTTP::host] “:” 1][HTTP::uri]

} else {

log local0. “--no redirect-- Request : [HTTP::uri]”

}

if { not ([HTTP::uri] contains “Raf.Api”)} {

log local0. “--redirect-- Request : [HTTP::uri]”

HTTP::redirect https://[getfield [HTTP::host] “:” 1][HTTP::uri]

} else {

log local0. “--no redirect-- Request : [HTTP::uri]”

}

if { not ([HTTP::uri] contains “Raf.Rest”)} {

log local0. “--redirect-- Request : [HTTP::uri]”

HTTP::redirect https://[getfield [HTTP::host] “:” 1][HTTP::uri]

} else {

log local0. “--no redirect-- Request : [HTTP::uri]”

}

if { [string tolower [HTTP::method]] eq “post” } {

if { [HTTP::header exists “Content-Length”] } {

if { [HTTP::header “Content-Length”] > 1048000 }{

set content_length 1048000

} else {

set content_length [HTTP::header “Content-Length”]

}

} else {

set content_length 1048000

}

if { $content_length > 0 } {

HTTP::collect $content_length

}

}

}

P.S: The part I want to modify is in bold

Thank You

Hi,

Can you try this?

when HTTP_REQUEST {
	switch -glob [HTTP::uri] {
		"*/Raf.Services/*" -
		"*/Raf.Rest/*" -
		"/Raf.Api/*" {
			log local0. "--no redirect-- Request : [HTTP::uri]"
		}
		default {
			log local0. "--redirect-- Request : [HTTP::uri]"
			HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
		}
	}
}