Forum Discussion

Tyson_James's avatar
Apr 25, 2016

Host Rewrite or iRule?

Hello All, I am a total noob when it comes to out F5 BIG-IP LTM. I know enough to do some pretty basis stuff. I have been asked to do something that I have never had to do before. My company has a need do what I think is a host URI rewrite or "something" Basically, I need to :

 

externalSiteA.company.com --> F5 vip/vs "repoints it to" --> internalSiteXYZ/aba/blabla/12345 ( This is being a very specific inside URL to an application.

 

Does this make sense. Any help would be greatly appreciated!!!! Thank you.

 

  • when HTTP_REQUEST {
    
      if { ([string tolower [HTTP::host]] eq "externalsitea.company.com") && ([HTTP::path] eq "/" ) }{
        HTTP::header replace Host "internalsitexyz"
        HTTP::path "/aba/blabla/12345"
      } else {
        return
      }
    
    }
    

    Client talks to 'externalsitea.company.com' and meanwhile, behind the scenes, F5 forwards such requests to your Pool Member as 'GET internalsitexyz/aba/blabla/12345'.

    That solution only masquerades headers. If you need to modify response payload (i.e. some HTML links), you will need to use a stream profile https://devcentral.f5.com/questions/rewrite-body-of-web-site

    • Tyson_James's avatar
      Tyson_James
      Icon for Cirrus rankCirrus
      Thanks for your response. That is doing "something", but I am getting an error. The external site to trying to "talk" to an Oracle application on the inside. I am getting an Oracle error that : Error Error processing request. ORA-01403: no data found OK
    • Hannes_Rapp_162's avatar
      Hannes_Rapp_162
      Icon for Nacreous rankNacreous
      What do you mean by external site? I'm trying to understand if the external site is a different application that talks to the Oracle service which is hosted via F5?
  • when HTTP_REQUEST {
    
      if { ([string tolower [HTTP::host]] eq "externalsitea.company.com") && ([HTTP::path] eq "/" ) }{
        HTTP::header replace Host "internalsitexyz"
        HTTP::path "/aba/blabla/12345"
      } else {
        return
      }
    
    }
    

    Client talks to 'externalsitea.company.com' and meanwhile, behind the scenes, F5 forwards such requests to your Pool Member as 'GET internalsitexyz/aba/blabla/12345'.

    That solution only masquerades headers. If you need to modify response payload (i.e. some HTML links), you will need to use a stream profile https://devcentral.f5.com/questions/rewrite-body-of-web-site

    • Tyson_James's avatar
      Tyson_James
      Icon for Cirrus rankCirrus
      Thanks for your response. That is doing "something", but I am getting an error. The external site to trying to "talk" to an Oracle application on the inside. I am getting an Oracle error that : Error Error processing request. ORA-01403: no data found OK
    • Hannes_Rapp's avatar
      Hannes_Rapp
      Icon for Nimbostratus rankNimbostratus
      What do you mean by external site? I'm trying to understand if the external site is a different application that talks to the Oracle service which is hosted via F5?