Forum Discussion
szia_80879
Nimbostratus
Oct 17, 2007Help with rewriting the URI
I am trying to create iRule(s) that would do the following:
- Users can come in on either port 80 or port 443. If a user comes in on port 80 they should be redirected to port 443. (It is do...
Colin_Walker_12
Oct 17, 2007Historic F5 Account
Well, it looks like you're almost there. The only thing you need to add now is the logic around the HTTP::uri command to change the uri as desired. If you're looking to change all Internal pool request URIs to /int/intsearch and all external request URIs to /ext/extsearch, you'd want something like:
redirection_acl_rule
this event is triggered when a client - BIPIP TCP connection is established
when CLIENT_ACCEPTED {
is client IP address defined in the trusted datagroup?
if { [matchclass [IP::client_addr] equals $::trusted_datagroup] } {
HTTP::uri /int/intsearch
pool Internal_7008_Pool
} else {
requests that did not match the conditions redirect to the External search
HTTP::uri /ext/extsearch
pool External_7006_Pool
}
log the client IP address -> destination IP address
log local0. "request accepted from client: \
[IP::client_addr] -> [IP::local_addr]"
}If you only wanted this done if they had no requested URI or a URI of "/", then you'd need some additional logic:
when CLIENT_ACCEPTED {
is client IP address defined in the trusted datagroup?
if { [matchclass [IP::client_addr] equals $::trusted_datagroup] } {
if{ [string length [HTTP::uri] <= 1 } {
HTTP::uri /int/intsearch
}
pool Internal_7008_Pool
} else {
requests that did not match the conditions redirect to the External search
if{ [string length [HTTP::uri] <= 1 } {
HTTP::uri /ext/extsearch
}
pool External_7006_Pool
}
log the client IP address -> destination IP address
log local0. "request accepted from client: \
[IP::client_addr] -> [IP::local_addr]"
}HTH,
Colin
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
