Forum Discussion

Emiliano's avatar
Emiliano
Icon for Nimbostratus rankNimbostratus
Apr 25, 2023

Keep URL after a redirect

Hi Guys,

I have an iRule that perform a redirect to an external website. I need to keep the original URL when the redirect is done.

Ex:

when HTTP_REQUEST {
if { [string tolower [HTTP::path]] contains "/sfnetios_xp"}
{
HTTP::respond 301 noserver Location http://example.com[HTTP::uri]

}

}

The original URL is www.testing.com and should be kept in the browser.

Thanks.

 

3 Replies

  • From the description you provided, it sounds like you want to do a reverse proxy of an external website (to keep the FQDN in the client's web browser address bar the same) as opposed to a redirect? Is this correct?

    If so, you will need to:

    1) Create a pool containing the public IP address (or alternatively an FQDN node) of the target website

    2) Enable SNAT to ensure that the return traffic routes back via the F5.

    3) Replace the 301 redirect in your iRule with the following:

     

    HTTP::header replace host "example.com"

     

    In addition, if the target site you are wanting to proxy is using https:// then you would also need to add a server SSL profile to the VIP.

     

  • Emiliano If you are wanting to perform and HTTP redirect to an external website then you cannot do that and maintain the original HTTP host header value. You can take the original HTTP host header and put that into a new field called the referer and then the external location could configure their side to look for www.testing.com in the referer header and then that remote side can perform a rewrite when they receive the traffic from example.com to www.testing.com. 

  • Hi Paulius, thanks for your assistance. I will check the referer header options and then configure on the remote site.

    Regards.