F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

Amit_Shah_6642's avatar
Amit_Shah_6642
Icon for Nimbostratus rankNimbostratus
Dec 18, 2013

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__Harlan's avatar
    Richard__Harlan
    Historic 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"
        }
    }
    
    • Richard__Harlan's avatar
      Richard__Harlan
      Historic F5 Account
      They should only see what they type in not what is set in the HTTP::uri
    • Amit_Shah_6642's avatar
      Amit_Shah_6642
      Icon for Nimbostratus rankNimbostratus
      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
  • 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.