Forum Discussion
URL Masking
We have URL http://abc.com/xyz/abcdeefg.html.
When user land to that page, we don't want user to see whole URL but only http://abc.com. I come up with below rule. Please let me know if that will work or need any change. Thank you.
when HTTP_REQUEST { if { [HTTP::uri] contains "/xyz" } { HTTP::uri "/" } }
5 Replies
- Richard__HarlanHistoric F5 Account
What the iRule you have will do is change the iRule to the server not to the client. The browser will still see the /xyz and the server will display the page for /. What I think you are trying to do is more like this
when HTTP_REQUEST { if { [HTTP::uri] contains "/xyz" } { HTTP::uri "/xyz/abcdeefg.html" } } - Amit_Shah_6642
Nimbostratus
Thank you Richard. What user will see in Address bar with your rule?
- Richard__HarlanHistoric F5 AccountThey should only see what they type in not what is set in the HTTP::uri
- Amit_Shah_6642
Nimbostratus
Do you mean "HTTP::uri "/xyz/abcdeefg.html" ? User will see http://abc.com/xyz/abcdeefg.html. correct? I want user to see only http://abc.com
- Kevin_Stewart
Employee
I'm afraid what you're asking for is not an easy thing to do. In the absence of any client side trickery, the state of an HTTP application, where you are in that application, is generally determined by its URI path. For example, if you have multiple pages within your application, how would users access them if all of the HTML links pointed simply to http://abc.com? The most common method for achieving this, interestingly, is with Ajax, where the main index page never changes but the content on that page is swapped out asynchronously via JavaScript. That's not something you would do in an iRule, but in the application itself. It technically could be done, but it wouldn't be the most intuitive thing in the world. Another option might simply be to mask the URI. There's still a path, but instead of "/xyz/abcdeefg.html", perhaps it's just "/foo". That of course would require some hefty mapping rules, but very much possible with something like a ProxyPass implementation or the rewrite profile in 11.4.
Ultimately, if you don't want the URI to change in the browser, then you can't allow the browser to request any URIs other than "/", which means you have to find another way to have the browser request a resource without changing the URI.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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