Forum Discussion

irshad's avatar
irshad
Icon for Nimbostratus rankNimbostratus
Dec 13, 2019

Irule Path change after string

Hi Experts,

 

Need suggestions on below query. We are trying to setup a redirect rule after string the path needs to change.

 

What ever path type after testcloud or testcloud.test.com it should come after https://eklm.fa.us2.testcloud.com/

 

Example:

Actual request: http://testcloud/myrequest or etc

 

should come as

 

HTTP::redirect https://myapps.microsoft.com/signin/test%20Fusion/da3ab29d-c42c-4682-87c1-165d7fc91029?tenantId=ff86d154-e37b-4fd7-a32d-64241a95e211&RelayState=https://eklm.fa.us2.testcloud.com/myrequest or etc

 

The current Irule is:

 

when HTTP_REQUEST {

#Scan the hostname and issue redirect to correct pool or node based on request

 

if {( [TCP::local_port] == 80 ) and ([string tolower [HTTP::host]] ne "testcloud")}{

HTTP::respond 301 location "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"

return

}

switch -glob [string tolower [HTTP::host]] {

"testcloud.test.com" -

"testcloud" {

HTTP::redirect https://myapps.microsoft.com/signin/test%20Fusion/da3ab29d-c42c-4682-87c1-165d7fc91029?tenantId=ff86d154-e37b-4fd7-a32d-64241a95e211&RelayState=https://eklm.fa.us2.testcloud.com/

return

}

default {

reject

#SSL::disable serverside

}

No RepliesBe the first to reply