Forum Discussion

Magnus_Parnerte's avatar
Magnus_Parnerte
Icon for Nimbostratus rankNimbostratus
May 15, 2014

Rewrite URL

This is what I would like to do: Browse a local internal website, http://mylocalwebsite.com/something Show the content from an external site http://www.external.com But keep the http://mylocalwebsite.com/something in the browser address bar Is this possible?

 

4 Replies

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    Depending on how the remote site is configured you could create a node (pool member) for the remote site and use it as a pool member for the VIP for mylocalwebsite.com. This will allow clients to visit www.external.com while leaving mylocalwebsite.com in the address field.

     

    However, in your example you're using a subfolder ("something") while you want to pull content from the root of the remote site. If this is required you can use HTTP::uri to rewrite the path. However, it would be much easier if you could use a subdomain (e.g. something.mylocalwebsite.com) instead of a subfolder, as that would eliminate the need to rewrite the request.

     

  • hi Arie

     

    i am new to irule so to implement this

     

    VIP we will create mylocalwebsite:80 behind it add pool member which which host content for the extenal website .

     

    And rewrite irule applied on the VIP will be something like this

     

    When HTTP_REQUEST { HTTP::header replace "www.external.com"

     

    }

     

    will this work ?

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    Hi Magnus,

     

    Not exactly.

     

    In a nutshell:

     

    1. Create a node with the IP-address of the remote site. The standard (ICMP) monitor may or may not work.
    2. Create a pool for the remote site and add the node from 1 as a member. Here you can add monitors like are more appropriate for the member.
    3. Create a VIP for "mylocalwebsite". Ideally you would use a subdomain (or drop the portion "/something/" from the path altogether). If that's possible you are now done. If not you'd have to create an iRule to rewrite the request and select the right pool.

    Questions for you:

     

    1) Is the domain "mylocalwebsite" used for anything else?

     

    2) If so, can you use a subdomain for this effort?

     

  • Arie, "mylocalwebsite" is our main website.

     

    As it is now we do a redirect to the external site when we find /something in the URI.

     

    Will try out your suggestion.

     

    Thanks, /Magnus