iRule to re-write headers & responses in both directions

hi all, hoping someone can point me in the right direction as this is hopefully a simple request.

i need to fully mask an intranet site as a totally different URL to avoid rolling out hosts files to everyone :slight_smile:

the intranet site we’re proxying is a 50/50 mix of “intranet.company.local” and “intranet.company.com” links, but in our environment those 2 DNS entries resolve to something entirely different, so i need to front-end it with something like “new-intranet.newcompany.local”

could quite happily run 2 DNS entries (eg: translate intranet.company.local to new-intranet.newcompany.local, and intranet.company.com to intranet.newcompany.com) but i just need to make sure all the content coming back to the clients is re-written so the links on the page appear correctly.

is this possible? :slight_smile:

thanks!

Hi,

You can bind a stream profile to your Virtual Server. It will allow you to rewrite content.

K7027: Replacing multiple strings using a Stream profile

The stream profile rewrite body but not headers. To rewrite a Redirect response, you should use an irule to rewrite the value of the Location header by using the string map command :

when HTTP_RESPONSE {
   set new_uri [string map {http https} [HTTP::header “Location”]]
   HTTP::header replace Location $new_uri
}