Forum Discussion
IRules to pass through request
Hi All,
I am using below rewrite rule with pass through in Apache webserver which is working fine. Now my requirement is not to use Apache webserver and route the traffic directly from F5 to application server and to achieve this i am trying to apply below rewrite rule pattern in F5(irules). Could you please help me for the same.
RewriteRule ^/([^/]+)/(.*)$ /content/obi/$1/en/$2.html [PT,L,QSA]
2 Replies
- Vijay_E
Cirrus
If you can provide the rewrite logic required, I think someone in devcentral may be able to assist you.
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.htmliRule:
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).PTNote: The
option is already implied withinL
and doesn't require special attention within iRules.PTCheers, 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
