Forum Discussion

JCMATTOS_41723's avatar
JCMATTOS_41723
Icon for Nimbostratus rankNimbostratus
Nov 26, 2007

Proxy Rewrite?

We have a LTM 9.4x and we would like to setup a test environment that will accept incoming requests on our company's VIP www.test.com and use it to proxy to another companies public external site www.????.com but rewrite it so when it returns to the client it see's our site www.test.com instead. I'm sure there's nothing that the magic irules can't do, but if you could be so kind and please point me in the right direction or suggestions we would greatly appreciate it...Thx!

7 Replies

  • Thx Aaron, It is a nice but very elaborate example. I just had a few questions regarding this script, in the data group section if a request is made to www.test.com/??? and the hostname is rewritten to www.test2.com/??? will the return response back show that of www.test.com/??? to the client?

     

     

    my data group config:

     

     

    www.test.com/ www.test2.com

     

     

    Secondly, if this redirect is an external site outside of the company. Do I still need to setup a pool for this VIP?
  • I haven't delved into all of the details of the rule, but the concept is to hide the rewriting of the URI from client. So if the client requests www.test.com they will not be redirected to www.test1.com and won't see the effects of the rewriting.

     

     

    Regardless of where the destination is, you need to configure the destination servers in a pool.

     

     

    Aaron
  • Okay here's what I got Aaron, not sure but the rule appears to be working on the debugging side:

     

     

    Nov 29 13:18:34 tmm tmm[1951]: Rule Test : ProxyPass(DEV-TEST-80, Host=www.test.com, URI=/): Found Rule, Client Host=www.test.com, Client Path=/, Server Host=www.test1.com, Server Path=

     

    Nov 29 13:18:34 tmm tmm[1951]: Rule Test : ProxyPass(DEV-TEST-80, Host=www.test.com, URI=/): Redirecting to http://www.test.com//

     

    Nov 29 13:18:34 tmm tmm[1951]: Rule Test : ProxyPass(DEV-TEST-80, Host=www.test.com, URI=//): Found Rule, Client Host=www.test.com, Client Path=/, Server Host=www.test1.com, Server Path=

     

    Nov 29 13:18:34 tmm tmm[1951]: Rule Test : ProxyPass(DEV-TEST-80, Host=www.test.com, URI=//): New Host=www.test1.com, New Path=/

     

    Nov 29 13:18:34 tmm tmm[1951]: Rule Test : ProxyPass(DEV-TEST-80, Host=www.test.com, URI=//): Found Rule, Client Host=www.test.com, Client Path=/, Server Host=www.test1.com, Server Path=

     

    Nov 29 13:18:34 tmm tmm[1951]: Rule Test : ProxyPass(DEV-TEST-80, Host=www.test.com, URI=//): New Host=www.test1.com, New Path=/

     

     

    However, when I hit the VIP www.test.com it still does not come up with a page any ideas?
  • Try taking a look at the codeshare page. There is a section which notes:

     

     

     

    One thing that needs to be clarified is the usage of a trailing forward-slash in the examples above. Unless you really know what you are doing and are trying to do something unusual, simply follow these rules:

     

     

    * For the left-hand-side entry only end the entry with a forward-slash if there is no other path. So “www.company.com/” and “/” are valid entries, but you would not want to end “www.company.com/path” or “/path” with a forward-slash.

     

    * For the right-hand-side entry follow the same rule as the left-hand-side entry above except you should always end the right-hand-side entry in a forward-slash if the left-hand-side entry also ends in a forward-slash.

     

     

     

     

    Based on that and the examples on the page, I'd assume you'd want to use this in your class:

     

     

    www.test.com/ www.test2.com/

     

     

    Aaron
  • Thx again Aaron, I tried the data groups and still no luck...What if I have no pools/nodes to use, and I wanted to use virtual forwarding directly to the external site while still utilizing this irule is it possible?

     

     

    Client ==> www.test.com ==> www.test1.com

     

    INTERNAL Private EXTERNAL Public

     

     

     

    Best Regards,

     

     

    JC
  • Patrick_Chang_7's avatar
    Patrick_Chang_7
    Historic F5 Account
    Your pool would be a pool of 1 member and the member would be the public IP address and port of the app you are trying to get to.