iRule to convert backend server response

I have a vendor web server I am able to make changes. It is set to use HTTP.

I would like to use the F5 LB infront of the application to provide https.

I have the F5 configured and a client cert installed… when I make a call to my application

https://test.domain.com it goes through the LB and the server returns http://10.10.10.10/web/guest;jsessionid=802CDB3F92D1167DBBBCC8D0CAE14782.tomcat1

How can I create an iRule that alters the response from the server to substitute the http://10.10.10.10 for https://test.domain.com ?

Thanks for assistance

Try something like this in an iRule attached to the VS:

when HTTP_RESPONSE {
if { [HTTP::header values Location] contains "10.10.10.10" } {
HTTP::header replace Location [string map {10.10.10.10 test.domain.com} [HTTP::header value Location]]
}
}