Forum Discussion
Striker_88408
Nimbostratus
Aug 28, 2007I'm new to iRules, i'm looking for a iRules who can can return an URI from a VIP
Hi every1 of the forum,
I'm new to iRules, so all help with this would be really appreciate.
I need to configure a iRules that can return an URI when i call the VIP adress. Do you...
hoolio
Cirrostratus
Aug 28, 2007Can you try this example to rewrite the Location header value to the fully qualified domain name that resolves to the VIP and see if this is what you're trying to achieve?
when HTTP_RESPONSE {
if {[HTTP::is_redirect]}{
set virtual_ip [clientside {IP::local_addr}]
set domain_name "host.example.com"
set location [HTTP::header value Location]
HTTP::header replace Location [string map [list $virtual_ip $domain_name] $location]
log local0. "Updated Location header: [HTTP::header value Location]"
}
}
If that works, then you can use a version with less variables and no logging:
when HTTP_RESPONSE {
if {[HTTP::is_redirect]}{
set domain_name "host.example.com"
HTTP::header replace Location [string map [list [clientside {IP::local_addr}] $domain_name] [HTTP::header value Location]]
}
}
Aaron
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