Forum Discussion
Kate_Kattar_107
Nimbostratus
Jul 14, 2008Cloaking part of a URI
Hello,
We would like to cloak part of the uri using an irule. We want users to go to http://website.ghg.co.uk - the irule should take them to http://website.ghg.co.uk/bmi although we don't the /bmi to show in the address bar.
Is this possible? How can I do this using BigIP?
Kind Regards
Kate
7 Replies
- hoolio
Cirrostratus
Hi,
You can rewrite the URI before the request is sent to the pool of web servers:when HTTP_REQUEST { Check if the URI doesn't start with /bmi if {not ([HTTP::uri] starts_with "/bmi")}{ Prepend /bmi HTTP::uri "/bmi[HTTP::uri]" } }
This won't affect any redirects or absolute references in the page content. If you need to modify the response headers you can use HTTP::header in the HTTP_RESPONSE event or for the response body, you can use a stream profile. I'd try using the above example first and see if it works though.
Aaron - Kate_Kattar_107
Nimbostratus
Thanks Aaron. I have attempted to paste the code below into a new irule. I get the msg:
01070151:3: Rule [Website_URI_cloak] error:
line 4: [wrong args] [HTTP::uri starts_with "/bmi"]
Any idea?
Kate - JRahm
Admin
Just a typo, that line should look like thisif {not ([HTTP::uri] starts_with "/bmi")}{ - Kate_Kattar_107
Nimbostratus
Thanks Guys, its works perfectly. Much appreciated.
Kind Regards
Kate - Colin_Walker_12Historic F5 AccountThat will, of course, come back with the Location header including the /bmi in the URL. If you're okay with that, then this will work as-is. If not, you'll need to add some Response logic to re-write the Location header on egress and make this a two-way re-write.
Colin - Kate_Kattar_107
Nimbostratus
I have this working on two VIPs, but have moved it to a third VIP that has SNAT turned on. It doesn't work. The SNAT is the only thing about the VIP setup that is different. Any ideas? - hoolio
Cirrostratus
Source address translation shouldn't affect the HTTP headers or content. I'm guessing the other difference is the application.
If you use LiveHttpHeaders for Firefox or Fiddler for IE, what requests do you see the client make? What responses do you see coming back from the application. You should be able to work your way back from the last request which fails to the app's previous response. I'm guessing as Colin suggested that the app might be referencing the modified URI so it's being rewritten twice in effect.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects