Forum Discussion
Steve_130921
Nimbostratus
Nov 15, 2013Changing the URL from the original VIP address to the Node's address
My customer is asking me if it is possible to change the URL that is presented on the Web page to reflect the actual real server name instead of the VIP DNS name. For troubleshooting purposes.
...
Kevin_Stewart
Employee
Nov 15, 2013It's pretty straight forward. Add an empty STREAM profile to your VIP and this iRule:
when HTTP_REQUEST {
STREAM::disable
HTTP::header remove "Accept-Encoding"
}
when HTTP_RESPONSE {
if { [HTTP::header value Content-Type] contains "text" } {
STREAM::expression "@[/body]@[LB::server addr][/body]@"
STREAM::enable
}
}
The STREAM profile here will add the chosen server's IP address just before the end body tag of the document. You could extend this in a few ways:
-
The additional information is more or less pure HTML, so you could through it all into a hidden object or HTML comment.
-
You could do a reverse lookup of that IP to get the server name, and then do the above:
when RULE_INIT { set static::dns_server 10.80.0.200 } when HTTP_REQUEST { STREAM::disable HTTP::header remove "Accept-Encoding" } when HTTP_RESPONSE { if { [HTTP::header value Content-Type] contains "text" } { set servername [RESOLV::lookup @$static::dns_server -ptr [LB::server addr]] STREAM::expression "@[/body]@$servername[/body]@" STREAM::enable } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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