Http Rewrite to 1 domain

I need to create an irule that is listening on 1 VIP and changes all incoming requests to a single domain to the server pool.

www.cname1.com/images → F5 VIP → www.static.com/images → pool of servers.

The incoming Domain can be anything but it will always need to be sent back to the webservers as www.static.com/images

would the following work

when HTTP_REQUEST {

set http_host HTTP::host

switch http_host {

{HTTP::redirect “http://www.static.com/”}

}

}

Using HTTP::redirect will send a 302 redirect back to the client with the Location in the redirect set to whatever you put in quotes. If you want to rewrite the Host header, you can use HTTP::header replace Host “newhost.example.com”:

when HTTP_REQUEST { 
  
     Rewrite host header 
    HTTP::header replace Host "www.static.com" 
  
     Rewrite URI? 
    if {not ([HTTP::uri] starts_with "/images")}{ 
  
        Prepend /images to the URI 
       HTTP::uri "/images[HTTP::uri]" 
    } 
 }

Aaron