Forum Discussion
Brian_69413
Nov 06, 2012Nimbostratus
Direct Server Access
I have the following iRule which seems to work at first, but then I see traffic to other pool members as well...not sure what I am missing here?
when RULE_INIT {
Log debug to /var/log/ltm? 1=yes, 0=no.
set ::debug_code 1
set ::server_direct 0
}
when HTTP_REQUEST {
Only apply rule if this request is coming from a internal addresses
if { [matchclass [IP::client_addr] equals $::internal_address_dg]} {
if { ([HTTP::uri] contains "?srv=") and ([HTTP::uri] contains "?port=") }{
set server_ip [URI::query [HTTP::uri] srv]
set server_port [URI::query [HTTP::uri] port]
set ::server_direct 1
if {$::debug_code}{log local0. "[IP::client_addr] is attempting to send [HTTP::host] traffic to $server_ip:$server_port"}
pool [LB::server pool] member $server_ip $server_port
}
}
}
when LB_FAILED {
If the selection fails and t
if {$::debug_code}{log local0. "Pool member selection failed, using default pool..."}
if { $::server_direct }{
HTTP::respond 200 content {
Invalid Direct Server Access: [HTTP::host][HTTP::uri]
}
}
}
- Brian_69413Nimbostratusthanks for all your help!
- What_Lies_Bene1CirrostratusYou're welcome. Hopefully nitass or hoolio (Aaron) will dive in at some point and offer a solution that I just can't see.
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