Forum Discussion
That's a fairly basic problem and I recommend you look into LTM Local Traffic policy feature for the most performance-efficient solution. However, you can also use an iRule provided below. Of course, you will also need two DNS entries - one of which is used by the general public, the other for your private LAN users/employees.
when HTTP_REQUEST {
if { ([HTTP::host] eq "abc123pqr456xyz789.azurewebsites.net") && (not ([class match [IP::client_addr] eq "private_net" ])) }{
HTTP::header replace Host "honest2.company.com"
}
}
Another important note, all HTML hyper-links and directory listings in your web-page should be RELATIVE. Otherwise, the response payload may reveal your internal HTTP host and some elements in your web-site will not load at all. External users won't be able to resolve your internal DNS name to any public IP address. Therefore, it's important the web-page has no hard-coded parts that refer to your private/internal Host name. If this criteria is not met, you will additionally need to look into using stream profiles that do similar replacements in the response payload.