Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

URI String manipulation

Claudio_Soares
Nimbostratus
Nimbostratus

Hello all,

 

Need help in manipulating URI

 

I need to redirect from https://domain1/fixedURI/randomURI to https://domain2/randomURI

I need to loose the fixedURI in the redirect process.

 

How can I do that?

 

I tried this, but it doesn't work out

 

when HTTP_REQUEST {

if {[HTTP::uri] starts_with "/123"} {

HTTP::uri [string trimleft [HTTP::uri] /123]

HTTP::redirect "https://[HTTP::host] [HTTP::uri]"

}

pool /DR/Pool_server_1

return

}

 

Thanks for your help,

 

Cláudio Soares

1 REPLY 1

Hi Cláudio Soares,

when HTTP_REQUEST {
	if { [HTTP::uri] starts_with "/fixedURI/" && [HTTP::host] equals "domain1" } {
		set newUri [string trimleft [HTTP::uri] /fixedURI]
		HTTP::redirect "https://domain2$newUri"
	}
}