Webredirect and URL Rewrite

I have a requirement for users to target an internal url but have it redirect to an external url, while preserving the original URL in the browser. So for example:

User targets → Myinternalsite@mycompanydomain.com Redirects to → externalsite@externaldomain.com

Target URL in the browser-> Myinternalsite@mycompanydomain.com

Can someone please comment on this?

Hi  @Franky-frank-reg7  - do any of these provide the answer you need?

BIG-IP Solutions: Simple URL Redirects

URL based redirection

iRule Recipe 1: Single URL Explicit Redirect

Need to redirect complete URL into redirected url

Unfortunately, these do not provide the information I need because again this is not just a redirect but they want to maintain the original header in the browser for an external website. Can someone please help here?

@Franky-frank-reg7  - working on finding a solution for you, but hopefully someone from the community can provide an answer more quickly. Maybe @Mohamed_Salah_1  ?

@Leslie_Hubertus  @Can someone please comment here? The request is becoming urgent as the days go by. I appreciate your time and attention. Thanks everyone in advance for your help.

So I was able to find an example that does the host header rewrite:

To update the Host header value without redirecting the client to the new Host value, you can use HTTP::header replace Host “newhost.example.com”. This update will only affect the request to the pool member. The client will not see the update unless the web application uses the requested host header value to generate response headers and/or content.

<span class="">when</span> HTTP_REQUEST <span class="">{</span>

   <span class=""># Check if requested host doesn't start with www.example.com</span>
   <span class="">if</span> <span class="">{</span><span class="">not</span> <span class="">([</span><span class="">string</span> tolower <span class="">[</span><span class="">HTTP</span><span class="">::</span>host<span class="">]]</span> <span class="">starts_with</span> <span class="">"www.example.com"</span><span class="">)}{</span>

      <span class=""># Replace the host header value with newhost.example.com</span>
      <span class="">HTTP</span><span class="">::</span>header replace Host <span class="">"newhost.example.com"</span>
   <span class="">}</span>
<span class="">}<br><br><br>The difference with my scenario is the destination URL is not a pool member, it's an external website. Can someone confirm if there's a way to make this work?<br>?</span>

Sounds like you’ve found your answer - thanks for sharing it. I’ve asked of my teammates to reply this afternoon just in case there’s another way to go.

Leslie,

The solution is not working, can you see the question posted above below:

1. The difference with my scenario is the destination URL is not a pool member, it’s an external website. Can someone confirm if there’s a way to make this work?

<span class="">The difference with my scenario is the destination URL is not a pool member, it's an external website. Can someone confirm if there's a way to make this work?<br>?</span>

OK - apologies, the weekend didn’t help response time to you @Franky-frank-reg7 . I’ve asked a teammate to take a look at your issue as soon as they can.

Are you wanting to rewrite, not redirect, the destination? A redirect will always update the location bar in the browser. If rewriting is your goal, you will need to creat a pool with FQDN of the external site you are trying to rewrite, then rewrite the host on request and the location on response. The solution on this thread should be exactly what you’re looking for.