Forum Discussion

SoLucky's avatar
SoLucky
Icon for Nimbostratus rankNimbostratus
Jul 26, 2016

How to keep the internal URL in browser address bar and point to external website

Is there a way to keep internal web address all the time and point it to public URL?

 

Let's say I have internal web address called honest2.company.com which has 10.10.2.35 and have public website hosted on Azure let's say abc123pqr456xyz789.azurewebsites.net and I create a VIP honest2_company_http VIP for 10.10.2.35; now anyone from my company access http://honest2.company.com for users the URL always remain as http://honest2.company.com but it will display content of abc123pqr456xyz789.azurewebsites.net

 

Is it possible via iRule, forward or reverse proxy or any other way? Please give me some pointers or clue.

 

  • Can't you just create an A record for honest2.company.com pointed at 10.10.2.35 and call it a day? It feels like we're greatly overthinking this. Make the pool member the actual IP of the real webserver and configure the webserver to handle requests for honest2.company.com. There is no need for iRules here as best I can tell.

     

    • SoLucky's avatar
      SoLucky
      Icon for Nimbostratus rankNimbostratus

      I did what you said but it still displays azure URL.

       

    • ekaleido_26616's avatar
      ekaleido_26616
      Icon for Cirrocumulus rankCirrocumulus

      Create a pool, make the external server the sole member. You're now proxying, users see the URL you want them to see, and you don't have to use an iRule.

       

    • SoLucky's avatar
      SoLucky
      Icon for Nimbostratus rankNimbostratus

      I know and I feel the same but we don't have pool (or any pool member) and need to use it as proxy, I hope it make sense.

       

  • Can't you just create an A record for honest2.company.com pointed at 10.10.2.35 and call it a day? It feels like we're greatly overthinking this. Make the pool member the actual IP of the real webserver and configure the webserver to handle requests for honest2.company.com. There is no need for iRules here as best I can tell.

     

    • SoLucky's avatar
      SoLucky
      Icon for Nimbostratus rankNimbostratus

      I did what you said but it still displays azure URL.

       

    • ekaleido's avatar
      ekaleido
      Icon for Cirrus rankCirrus

      Create a pool, make the external server the sole member. You're now proxying, users see the URL you want them to see, and you don't have to use an iRule.

       

    • SoLucky's avatar
      SoLucky
      Icon for Nimbostratus rankNimbostratus

      I know and I feel the same but we don't have pool (or any pool member) and need to use it as proxy, I hope it make sense.

       

  • Try something like this example:

    when HTTP_REQUEST {
    if { [HTTP::host] contains "abcd.com" } {
    HTTP::host [string map {abcd.com xyz.com} [HTTP::host]] 
    }
    }
    
    when HTTP_RESPONSE {
    if { [HTTP::header values Location] contains "xyz.com" } {
    HTTP::header replace Location [string map {xyz.com abcd.com} [HTTP::header value Location]]
    }
    }
    
  • 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"
      }
    }
    
    • SoLucky's avatar
      SoLucky
      Icon for Nimbostratus rankNimbostratus

      Not sure about that, though your iRule looks good and somehow I was hoping to work as it is. I will keep digging and see if I can get any success, thanks for your help.

       

    • Hannes_Rapp_162's avatar
      Hannes_Rapp_162
      Icon for Nacreous rankNacreous

      Possibly not NATed to external IP, or in general, something is not properly routed. Check with tcpdump to see what's going on. This is generally something the forum cannot assist you with as we don't have the overview of your network. Another idea to further isolate the troubleshooting scope is to try connecting from the outside internet.

       

    • SoLucky's avatar
      SoLucky
      Icon for Nimbostratus rankNimbostratus

      Source Address Translation option was at "Auto Map", I tried with "None" but still getting "This page can’t be displayed". I also tried replacing abc123pqr456xyz789.azurewebsites.net with www.google.com but no luck.

       

  • 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"
      }
    }
    
    • SoLucky's avatar
      SoLucky
      Icon for Nimbostratus rankNimbostratus

      Not sure about that, though your iRule looks good and somehow I was hoping to work as it is. I will keep digging and see if I can get any success, thanks for your help.

       

    • Hannes_Rapp's avatar
      Hannes_Rapp
      Icon for Nimbostratus rankNimbostratus

      Possibly not NATed to external IP, or in general, something is not properly routed. Check with tcpdump to see what's going on. This is generally something the forum cannot assist you with as we don't have the overview of your network. Another idea to further isolate the troubleshooting scope is to try connecting from the outside internet.

       

    • SoLucky's avatar
      SoLucky
      Icon for Nimbostratus rankNimbostratus

      Source Address Translation option was at "Auto Map", I tried with "None" but still getting "This page can’t be displayed". I also tried replacing abc123pqr456xyz789.azurewebsites.net with www.google.com but no luck.