Forum Discussion

scarpozzi_82104's avatar
scarpozzi_82104
Icon for Nimbostratus rankNimbostratus
Jan 26, 2011

Reverse-proxying & URI rewriting

I may be creating a lot of work, but I'm wondering if this can be done via an iRule.

 

 

We've got a webserver here that's hosting personal web space for a few thousand users. We have a vendor that's willing to host these for us, but we want to make it transparent to the user. Currently, the URL/URI is formatted http://users.site.com/username When we switch to the new system, the URL will be http://external.host.com/xp/company/username/

 

 

If the user types the URL/URI format I first mentioned, that should be fairly straightforward...I'm just wondering how to write an iRule that would cover extra characters the users may add, like http://users.site.com/username/ or http://users.site.com/username/folder1/index.html to disect and reassemble it on the other side. Are there any examples/documentation of how to do these kinds of rewites for a reverse-proxy?

 

 

 

If that's not going to be possible or too complicated, I'll settle for a redirect.

 

 

 

Thanks.
  • Will the file/folder structure still be the same?

     

     

    So, if users.site.com/username/folder1/index.html exists, will external.host.com/xp/company/username/folder1/index.html also exist?

     

     

    When you say transparently, does this mean the user won't be redirected to their site or that they simply won't have to click anything?
  • The file/folder substructure will be the same from the user's folder down...so your example is correct.

     

     

    When I say transparently, I'm referring to a reverse-proxy configuration...if F5 can do that. I've worked with other load balancer products that can.

     

     

    What I was wanting was this action: The user types in the first URL: "http://users.site.com/username" and gets the content from the external URL site. While proxying the content from the external site, HTML content that matches the external.host.com/xp/company is rewritten dynamically to match users.site.com so non-relative html links won't get broken. Can the F5 do that? We didn't have enough money for proper training after we bought these boxes. =P

     

     

    If I can't do the html rewriting, I'll be forced to settle for a redirect. The redirect would allow users to stick with our old URL and give them time to start learning the external URL...it's just a longer URL/URI combination for them to remember and learn.
  • The file/folder substructure will be the same from the user's folder down...so your example is correct.

     

     

    When I say transparently, I'm referring to a reverse-proxy configuration...if F5 can do that. I've worked with other load balancer products that can.

     

     

    What I was wanting was this action: The user types in the first URL: "http://users.site.com/username" and gets the content from the external URL site. While proxying the content from the external site, HTML content that matches the external.host.com/xp/company is rewritten dynamically to match users.site.com so non-relative html links won't get broken. Can the F5 do that? We didn't have enough money for proper training after we bought these boxes. =P

     

     

    If I can't do the html rewriting, I'll be forced to settle for a redirect. The redirect would allow users to stick with our old URL and give them time to start learning the external URL...it's just a longer URL/URI combination for them to remember and learn.
  • Thanks.

     

     

    I've seen examples of this using HTTP::retry. If I have time today, I'll see if I can whip something up.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__retry.html