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.htm, the ideal way is to only show www.domain.com which is good for search engine crawlers and improves our search rankings.
Would something like this work?
when HTTP_RESPONSE {
if { [HTTP::status] starts_with "3" } {
set origRedir [HTTP::header Location]
set newRedir [string map {"/home/default.htm" "" } [HTTP::header Location]]
HTTP::header replace Location $newRedir
log local0. "Original redirect: $origRedir."
log local0. "Rewritten redirect $newRedir"
}
}
- hooleylistCirrostratusHi Gregg,
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} } }
- gGnome_32510NimbostratusHmmm. I replied to this days ago, but my reply does not appear to have posted. Oh well, another puzzle for the noob. Thanks again for your response, Aaron.
- dennypayneEmployeeI think Aaron means that a user could simply type the full path with the ".." which would track back up the directory tree and get into those other directories, because the iRule would only fire if /home wasn't in the request. Of course they would have to know to try that, but forced browsing is a popular attack method.
- gGnome_32510NimbostratusDenny, Thanks for the suggestion. I will look into the ASM. In the meantime, much thanks to both you and Aaron. This gives me a reasonably good start.
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