forward alternate hostname to internal server

I have a simple problem

My external DNS record if different to my internal DNS. I also host multiple site on the same web server using hostname to differentiate between the sites.

So I need to do the following to a reqest form the out side going to the inside

publicFQDN1 -- > InternalFQDN1

publicFQDN2 --> Internal FQDN2

What is the best and easiest way to do this. It looks like using a HTTP service profile will work for translating one.

I have not managed ot do this though.

Ans I am sure there is an irule way of doing this but i woudl prefer to not use an irule.

As you want to rewrite the host rather than the URI, your only option here is an iRule I’m afraid. If you wanted to redirect or rewrite the URI a HTTP Class would have done it.

You’d need a rule like so;

when HTTP_REQUEST {
 if { [string tolower [HTTP::header value Host]] equals "publicfqdn1" } {
  HTTP::header replace "Host" internalfqdn1
  return }
 elseif { [string tolower  [HTTP::header value Host]] equals "publicfqdn2" } {
  HTTP::header replace "Host" internalfqdn2
  return }
}