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 have an idea of how to do that ?
Thank you in advance,
- hoolio
Cirrostratus
If you want an iRule that sends a canned HTTP response, you can use the HTTP::respond command (Click here).when HTTP_REQUEST { HTTP::respond 200 "some html content" }
when HTTP_REQUEST { HTTP::redirect http://somehost.example.com }
- Striker_88408
Nimbostratus
Hmm ok ill try to explain a more what i'm looking for. - hoolio
Cirrostratus
When a client makes a request for the VIP, 10.x.y.z, BIG-IP selects a node to send the request to. By default, the BIG-IP doesn't change the node's response headers or data. The node might be sending a redirect to the node's IP address. Or the node might be inserting a hardcoded reference to it's own IP address in the HTTP content. - Striker_88408
Nimbostratus
Hello again, - hoolio
Cirrostratus
Can 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]" } }
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]] } }
- hoolio
Cirrostratus
Actually... I just reread what you wrote and I think I misinterpreted it. - Striker_88408
Nimbostratus
Hello 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