Forum Discussion

RajX_87248's avatar
RajX_87248
Icon for Nimbostratus rankNimbostratus
Jul 01, 2011

Proxypass i Rule Help

Hi Iam trying to do site direction from www.mycompany.com/forums to http://forums.externalhostedcompany.com using proxypass irule. However, the traffic seem to be actually not getting redirected but just the header values changed and still sent to my inside virtual server hosted behind BIG-IP config. The reason I choose proxypass over simple http redirect is to keep the connection open so I can get the connection back from user when he is done with forums etc...

 

 

My questions are:

 

 

1) am I correct in choosing proxypass irule for for this kind of redirection ??

 

2) how do I make the proxypass irule actually send the traffic to http://forums.externalhostedcompany.com which is hosted else where on the internet ??

 

 

Thanks

 

RX
  • Hi RX,

     

     

    If you want the client to see the change in the address bar, you'd want to use a different iRule that sends a 30x redirect. ProxyPass by design hides the rewriting. If you want the traffic for an external site proxied through your virtual server you'd need to rewrite the requests like ProxyPass does rather than send them a 30x redirect. To use ProxyPass for an external site, just set up your VS default pool for the server IP address(es) that host the remote content. You'll need a route on LTM for the remote servers and SNAT on the virtual server. If you have multiple pools which serve the content, you can specify the pools in the ProxyPass datagroup. You can check the comments in the ProxyPass rule for details on these points.

     

     

    Aaron
  • Thanks Aaron... that gives me something to work towards. I deinetely wants to hide the external URL so proxypass is the best choice.

     

     

    However, Iam only redirecting a subdirectory ( in this case www.mycompany.com/forums.) So when you say setup the VS default pool for the server IP address(es) that host remote content, wouldnt that mess up the default VS for the whole of www.mycompany.com ???
  • So you can set up the proxypass config datagroup like this:

     

     

    "/forums" := "http://forums.externalhostedcompany.com/ forums_external_pool",

     

     

    Then set the default pool of the virtual server to the servers which serve content for everything else but /forums. I'd test this on a test virtual server first if your main VS is in production.

     

     

    Aaron

     

  • OK now It's working perfect for the /subdirectories but however I am trying to do another layer of subdirectories and its failing.

     

     

     

    I have :

     

     

    www.mycompany.com/subdir1/subdir2 which I am trying to redirect to www.someothercompany.com . It works up to www.mycompany.com/subdir1 level but fails over when I tried to use for subdir2 level.

     

     

    I believe these are the lines which makes it fail:

     

     

    if {[substr $clientside 0 1] eq "/"} {

     

    No virtual hostname specified, so use the Host header instead

     

    set host_clientside $orig_host

     

    set path_clientside $clientside

     

    } else {

     

    Virtual host specified in entry, split the host and path

     

    set host_clientside [getfield $clientside "/" 1]

     

    set path_clientside [substr $clientside [string length $host_clientside]]

     

     

     

    Any ideas on how I can deal with these double "/subdir1/subdir2/" slashes issue ??

     

  • btw, my datagroup entry would be like this:

     

     

    /subdir1/subdir2 www.someothercompany.com new_pool_name SNAT_IP
  • OK finally I got it working.... Thanks to the Proxypass dev team and Aaron for troubleshooting tips.