Forum Discussion
irule - basic insertion of text to url
An irule is used to capture requests to our https domains and redirect appropriately. All entries in this irule have been simple redirects from external address to the internal server on the same internal uri, such as to server/A.
We have a new website that needs publishing on a different url to that on itself. This means the new url needs redirecting from "" to //server/script/abc/.
Is there a way to do this without branching off into variables?An extract of our irule follows, looking forward to your help!
(BigIP v13.1.1)
:
set my_uri [ string tolower [HTTP::uri]]
...
if { [HTTP::uri] starts_with "xyz"} {
pool xyz
} elseif { $my_uri starts_with "x"} {
pool Pool_x
...
} elseif { $my_uri starts_with "/abc"} {
pool Pool_ABC
...
Hi JemW,
a very minimalistic iRule will look like below...
when HTTP_REQUEST { set low_uri [string tolower [HTTP::uri]] if { $low_uri starts_with "/xyz"} then { pool Pool_xyz } elseif { $low_uri starts_with "/x"} then { pool Pool_x } elseif { $low_uri starts_with "/abc"} then { HTTP::path "/scripts[HTTP::path]" pool Pool_abc } }
Note: Depending on how the web application is made, you may need to modify the HTTP responses too. If the application references
in its HTML/CSS/etc., you will need to adjust those references to/scripts/abc
before sending the response to your clients. Be warned, it will be time consuming to adjust complex applications.../abc
Cheers, Kai
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