Forum Discussion
IRules to pass through request
Hi Ashish,
you may try the iRule below as a startingpoint to replace your existing mod_rewrite functionality.
The iRule will rewrite a client side request of...
http(s)://www.domain.tld/path1/path2?query=1
... to a server side request of ...
http(s)://www.domain.tld/content/obi/path1/en/path2.html?query=1
... or ...
http(s)://www.domain.tld/path1/path2/path3
... to ...
http(s)://www.domain.tld/content/obi/path1/en/path2/path3.html
iRule:
when HTTP_REQUEST {
Replacement for QSA option
if { [HTTP::query] ne "" } then {
set input_query "?[HTTP::query]"
} else {
set input_query ""
}
Replacement for RewriteRule
set root_folder [substr [HTTP::path] 1 "/"]
set remaining_path [string range [HTTP::path] [expr { [string length $root_folder]+2 }] end]
HTTP::uri "/content/obi/${root_folder}/en/${remaining_path}.html${input_query}"
}
Note: You may also post any previous RewriteRules to see if certain URIs requiring exemptions for the given rewrite.
Note: To assist you with the
option, its required to know your existing aliases (if configured). PT
Note: The
option is already implied within L
and doesn't require special attention within iRules.PT
Cheers, Kai
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
