Forum Discussion
Hide/Mask URL using iRule
I would like to mask my home page URL path via an iRule condition because currently when a user navigate to my domain (http://www.mysite.com), it is redirected to an MCMS server base content (http://www.mysite.com/home/default.htm). I would just like to hide or mask that redirected path via iRule code so when a user navigates to my home page, the address bar will only display my domain URL (http://www.mysite.com).
Illustration:
From:
http://www.mysite.com/home/default.htm
To:
http://www.mysite.com
Can anyone suggests some options I can try?
In addition to this, I would like to ask what is the difference between HTTP::path and HTTP::uri and which of these will best support my objective (masking the URL)
Kindly advice, thanks!
7 Replies
- lmwf1_55268
Nimbostratus
I can help you with one.
url:
http://www.example.com:8080/main/index.jsp?user=test&login=check
path:
/main/index.jsp
uri:
/main/index.jsp?user=test&login=check
host:
www.example.com:8080 - James_Quinby_46Historic F5 Accounttobs -
What you're looking for, I think, is the ability to proxy URLs (along the lines of a ProxyPass apache's mod_proxy). Take a look at the irule here:
http://devcentral.f5.com/wiki/default.aspx/iRules/ProxyPass.html
Scroll past the rule to the description below and see if this is the functionality you're looking for. - AndrewO_4840
Nimbostratus
If you're only worried about that URI then a simple rule like this would suffice:when HTTP_REQUEST { if [HTTP::uri == "/"] { HTTP::uri "/home/default.htm" } }
This simply checks the incoming URI. If it is "/" (i.e. top page of your site) then it silently rewrites the request to /home/default.htm" before passing it onto the server. - tobs_93015
Nimbostratus
Hi andrewO
Thanks for your reply, you said that the rule you stated will check if the URL entered starts at "/" it will silently rewrite it to "/home/default.html", what do you mean by "silently rewrite it to /home/default.html"?
Will the address bar show only my domain (http://www.mysite.com)? Kindly confirm, thanks! - tobs_93015
Nimbostratus
Hi lmwf1 and jquinby,
Thanks for your reply!!! - tobs_93015
Nimbostratus
Hi andrewO
Thanks for your reply, you said that the rule you stated will check if the URL entered starts at "/" it will silently rewrite it to "/home/default.html", what do you mean by "silently rewrite it to /home/default.html"?
Will the address bar show only my domain (http://www.mysite.com)? Kindly confirm, thanks!- Tosin_Omojola
Altostratus
If I may clarify what AndrewO meant in his reply, he means that the irule would check if the uri IS ( not that it starts with). An irule that checks if the uri STARTS WITH, looks like below:
when HTTP_REQUEST { if [HTTP::uri starts_with "/"] { HTTP::uri "/home/default.htm" } }but AndrewO actually meant == or eq ( both of which means equal to ).
Now, by "silently rewrites" it means the uri "/" would be replaced with "/home/default.htm" and, yes, that is what your browser will display in its address bar, that is, (http://www.mysite.com/home/default.htm)
Cheers
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