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

Need Help for iRule

Aj2
Nimbostratus
Nimbostratus

Need Help to write irule :
Redirects are for HTTP requests made with a path prefix matching https://xyz.test.com/age/signup.
Matching requests should be redirected to https://abc.test.com/#/inSign/invite,
Additionally, a new query parameter should be appended to the resulting URL: account=xyz
The redirected request should include the query parameters supplied from the original request before the redirect.

3 REPLIES 3

Paulius
MVP
MVP

@Aj2 This should do exactly what you would like for the hosts and uri paths provided.

when HTTP_REQUEST priority 500 {

    set HOST [HTTP::host]
    set URI [string tolower [HTTP::uri]]

    if { ((${HOST} == "xyz.test.com") && (${URI} == "/age/signup")) } {
        HTTP::redirect "https://abc.test.com/#/inSign/invite?account=xyz"
    }

}

Awesome @Paulius , 

I will add an info for you , its highly recommended to give up using variables in your Scripts , and use it when you have to use it only. 
that's for performance concerns.


_______________________
Regards
Mohamed Kansoh

Not sure in this case, Mohamed...

I get a feeling the example is more general, and variables would be needed. When Aj2 wrote "zyz" I imagine it may take up any value.

@Aj2, can you confirm the need for string replacement in your request? Or did Paulius answer your needs 100%?

/Mike