Forum Discussion
alinayesina_102
Mar 13, 2009Nimbostratus
Responce URI Masking/Hiding
We would like to consult on the possibility of performing a URL rewrite with the use of an iRule for domain.com. it’s not a good practice for our homepage to show as http://www.domain.com/home/default...
hooleylist
Mar 27, 2009Cirrostratus
Hi Gregg,
Why are you trying to hide the path? Is it for security purposes? Or some other reason?
1 isn't really possible. A normal session flow for HTTP would be a client makes a request to /. The web application sends back an HTML response with links in it. If the client clicks on a link, the browser address bar is updated to the new location and the browser makes a request to the web application with the new location set in the request line. You could create a one to one mapping of the URI a client requests to a backend URI, but you cannot say that you want to have the client make a request to /home but have an iRule dynamically rewrite the URI to different paths.
2 is possible to try, but it's easily bypassed. You could use an iRule to check if the path starts with /home and allow access to the pool and for all other requests, redirect the client. However, if a client made a request to /home/../other_directory/ it would pass the iRule logic and be processed as /other_directory/ by the web server.
when HTTP_REQUEST {
Check if requested path doesn't start with /home
if {not ([HTTP::path] starts_with "/home")}{
Redirect the client to /home
HTTP::redirect "http://[HTTP::host]/home"
OR
Respond with an access denied message
HTTP::respond 403 content {some html explaining the response}
}
}
Aaron
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