Forum Discussion
zhangyuyao_1600
Nimbostratus
Aug 04, 2016iRule can't execute the virtual command when using [clientside {TCP::local_port}]
There is an iRule below :
when CLIENT_ACCEPTED {
if {[IP::addr [IP::client_addr] equals 114.255.174.240] } {
set Destination_Port [clientside {TCP::local_port}]
if {($Destination_Port >= 10069) and ($Destination_Port <= 10124)} {
virtual VS_4809_Troubleshooting_443}
elseif {($Destination_Port >= 11069) and ($Destination_Port <= 11124)} {
virtual VS_4809_Troubleshooting_80}
else { pool pool_4809_Troubleshooting_443}
}
}
Traffic can be distinguished by destination port,but it can't be distributed to specified VS.
1 Reply
Hi Zhangyuyao,
there is no need to switch into the client side context if you are already in the client side context. Using the
/[clientside]
command is just required in those usecases where you need to execute client side command in the server side context or a serverside command in the client side...[serverside]Try the irule below... it should be able to query the local portnumber and perform the
/[pool]
routing decission based on it.[virtual]when CLIENT_ACCEPTED { if { [IP::addr [IP::client_addr] equals 114.255.174.240] } then { if { ([TCP::local_port] >= 10069) and ([TCP::local_port] <= 10124) } then { virtual VS_4809_Troubleshooting_443 } elseif { ([TCP::local_port] >= 11069) and ([TCP::local_port] <= 11124) } then { virtual VS_4809_Troubleshooting_80 } else { pool pool_4809_Troubleshooting_443 } } }Note: You can still issue the
command, but there is really no need to do so in the[clientside { TCP::local_port }]
event.CLIENT_ACCEPTEDCheers, Kai
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