Update Location Header in case of 302

Hi, What will be the best option to update Location URI in response if 302 redirect is present.

Purpose is not to update Host but to remove specific string from uri.

e.g

Actual: www.carrerslocation.com/contact

Rewrite In request to server from /contact/ to /myapp/index.php?contactus

Response Update Loaction to : www.carrerslocation.com/contact/index.php?contactus

Something like this may help, if you have specific hhost(s) you’re looking at. Otherwise, you could use the URI command to parse the location header and do some more specific replacements.

when HTTP_RESPONSE {
    if { [HTTP::is_redirect] } {
        switch -glob -- [string tolower [HTTP::header value location]] {
            "*www.carrerslocation.com/contact"} {
                HTTP::header replace location [string map -nocase {/contact /contact/index.php?contactus} [HTTP::header value Location]"
            }
    }
}